|
|
back to boardTest #6 What's wrong? #include <iostream> using namespace std; int main() { int k,a[1001],i(0),s(0),maxs(0),j(0); cin >> k; while(i<k) { cin >> a[i]; i++; } for (i=0; i<k; i++){ if (a[i]==a[i+1] && a[i]==a[i+2]) { s = a[i]*3; j = i+2; } if (s > maxs) { maxs = s; s = 0; } } cout<<maxs<<"\n"<<j<<endl; } Edited by author 10.02.2014 22:44 |
|
|