#include <stdio.h> using namespace std; int main(){ int n; while( ~scanf("%d", &n) && n != 0 ){ int arr[n]; for( int i=0; i<n; i++ ){ scanf("%d", &arr[i]); } int max = arr[0]; for( int i=0; i<n; i++ ){ int sum = 0; for( int j=i; j<n; j++ ){ sum += arr[j]; if( sum> max ){ max = sum; } } } printf("%d\n", max); } return 0; } /* Main.c:2:1: error: unknown type name 'using' using namespace std; ^~~~~ Main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' using namespace std; ^~~ */ |
Double click to view unformatted code.