|
|
вернуться в форумWA#20 #include <iostream> using namespace std; void main() { int n; int a[998]; cin>>n; int i; int s=0; int smax=0; int imid=0; for(i=0;i<n;i++) { cin>>a[i]; } for(i=0;i<n-2;i++) { s=a[i]+a[i+1]+a[i+2]; if(s>smax) { smax=s; imid=i+2; } } cout<<smax<<" "; cout<<imid; } What did i do wrong ? Re: WA#20 why have you taken array of size 998? make it 1000. |
|
|