#include <iostream> using namespace std; int main() { int num_all; cin >> num_all; string ret = ""; int counter = 0; bool isFinished = false; for(int i = 1; i <= num_all; i++){ string move_on; int participated; cin >> move_on; cin >> participated; if(isFinished || move_on == "NIE" || (counter > 10 && participated >= 2)) continue; ret += to_string(i) + " "; counter++; if(counter >= 20) isFinished = true; } cout << ret; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <iostream> using namespace std; int main() { int num_all; cin >> num_all; string ret = ""; int counter = 0; bool isFinished = false; for(int i = 1; i <= num_all; i++){ string move_on; int participated; cin >> move_on; cin >> participated; if(isFinished || move_on == "NIE" || (counter > 10 && participated >= 2)) continue; ret += to_string(i) + " "; counter++; if(counter >= 20) isFinished = true; } cout << ret; return 0; } |