#include #include int main() { long n,m,c,max,r,currc; long cap[1000]; bool on[1000]; bool blow; ifstream in("fuses.in"); in >> n; in >> m; in >> c; int kase = 1; while(n>0 && m>0 && c> 0) { for(long i=0; i> cap[i]; for(long i=0; i> r; r-=1; if( on[r] ) currc -= cap[r]; else currc += cap[r]; on[r] = (! on[r]); if( currc > c ) blow=true; if( currc > max ) max = currc; // cout << "currc " << currc << endl; } cout << "Sequence " << kase << endl; if( blow ) cout << "Fuse was blown." << endl << endl; else { cout << "Fuse was not blown." << endl; cout << "Maximal power consumption was " << max << " amperes." << endl << endl; } in >> n; in >> m; in >> c; kase++; } return 0; }