//这题贡献了两次RE,因为我开始是这样想的:只要在输入的过程中,有fuse大于其c值的,就中断输入,直接输出结果就结束,谁知道RE了! #include <iostream> using namespace std; struct Info { int fuse; bool state; }devices[30]; int main() { int n, m, c, i, j, op, ans, sum, tc = 0; bool flag; while (cin >> n >> m >> c) { if (n == 0 && m == 0 && c == 0) break; ans = sum = 0; flag = false; tc++; for (i = 1; i <= n; i++) { cin >> devices[i].fuse; devices[i].state = 0; } for (i = 0; i < m; i++) { cin >> op; if (devices[op].state == 0) { devices[op].state = 1; sum += devices[op].fuse; } else if (devices[op].state == 1) { devices[op].state = 0; sum -= devices[op].fuse; } if (sum > ans) ans = sum; } if (ans > c) { cout << "Sequence " << tc << endl; cout << "Fuse was blown." << endl << endl; } else { cout << "Sequence " << tc << endl; cout << "Fuse was not blown." << endl << "Maximal power consumption was " << ans << " amperes." << endl << endl; } } system("pause"); }