244 afișări Taivan Mihail (mihailtaivan) 13 feb
www.pbinfo.ro
Etichete: nicio etichetă

#include <iostream>
using namespace std;

int n, x1005;

int main(){ cin >> n; for(int i = 1 ; i <= n; ++i) cin >> x[i]; int st = 0, dr = -1; for(int i = 1 ; i <= n; ++i) if(x[i] 0) { int j = i + 1; while(j <= n && x[j] 0) j ++; if(j – i > dr – st + 1) st = i, dr = j-1; i = j; } cout << st << “ “ << dr; return 0;
}


244 afișări Taivan Mihail (mihailtaivan) 13 feb
www.pbinfo.ro
Du-te sus!