#include "maklib.h" #include "message.h" #include <cstdio> int main() { long long result = 0, tmp = 0; for(int i=1;i<=Size();++i) { if(tmp>0)tmp+=ElementAt(i); else tmp=ElementAt(i); if(tmp>result) result=tmp; } if(MyNodeId() == 0) { if(result > 0) printf("%lld\n", result); else printf("0\n"); } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include "maklib.h" #include "message.h" #include <cstdio> int main() { long long result = 0, tmp = 0; for(int i=1;i<=Size();++i) { if(tmp>0)tmp+=ElementAt(i); else tmp=ElementAt(i); if(tmp>result) result=tmp; } if(MyNodeId() == 0) { if(result > 0) printf("%lld\n", result); else printf("0\n"); } return 0; } |