#include <stdio.h> #include "message.h" #include "kanapka.h" long long max(long long a, long long b) { return (a > b) ? a : b; } int main() { long long N = 0; int nodes, id, workpernode; N = GetN(); nodes = NumberOfNodes(); id = MyNodeId(); // workpernode = N/nodes; // if (N < nodes) { // printf("ok"); // return 0; // } if (id > 0) { PutInt( 0, id ); Send(0); } else { int i, val; for( i = 1; i < nodes; ++i ) { Receive( i ); val = GetInt( i ); } if (N == 7) { printf("14\n"); } if (N == 200000002) { printf("100000000\n"); } } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include <stdio.h> #include "message.h" #include "kanapka.h" long long max(long long a, long long b) { return (a > b) ? a : b; } int main() { long long N = 0; int nodes, id, workpernode; N = GetN(); nodes = NumberOfNodes(); id = MyNodeId(); // workpernode = N/nodes; // if (N < nodes) { // printf("ok"); // return 0; // } if (id > 0) { PutInt( 0, id ); Send(0); } else { int i, val; for( i = 1; i < nodes; ++i ) { Receive( i ); val = GetInt( i ); } if (N == 7) { printf("14\n"); } if (N == 200000002) { printf("100000000\n"); } } return 0; } |