#include "maklib.h" #include "message.h" #include <cstdio> int main() { if(MyNodeId()==0) { int out = 0, temp = 0; for (int i = 1; i<=Size(); ++i) { if(temp > 0) temp += ElementAt(i); else temp = ElementAt(i); if(temp > out) out = temp; } if(out<=0) puts("0"); else printf("%d\n", out); } 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 | #include "maklib.h" #include "message.h" #include <cstdio> int main() { if(MyNodeId()==0) { int out = 0, temp = 0; for (int i = 1; i<=Size(); ++i) { if(temp > 0) temp += ElementAt(i); else temp = ElementAt(i); if(temp > out) out = temp; } if(out<=0) puts("0"); else printf("%d\n", out); } return 0; } |