#include "maklib.h"
#include "message.h"
#include <iostream>
typedef long int lint;
typedef long long int llint;
int main()
{
const lint size = Size();
llint current = 0;
llint best = 0;
for( lint i=0; i<size; i++ )
{
const lint element = ElementAt( i+1 );
if( current + element > 0 )
current = current + element;
else
current = 0;
if( current > best )
best = current;
}
if( MyNodeId() == 0 )
std::cout << best << '\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 | #include "maklib.h" #include "message.h" #include <iostream> typedef long int lint; typedef long long int llint; int main() { const lint size = Size(); llint current = 0; llint best = 0; for( lint i=0; i<size; i++ ) { const lint element = ElementAt( i+1 ); if( current + element > 0 ) current = current + element; else current = 0; if( current > best ) best = current; } if( MyNodeId() == 0 ) std::cout << best << '\n'; return 0; } |
English