#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string s; int ile=0,x; for(int i = 1 ; i <= n; i++){ cin >> s >> x; if (ile < 20 && s == "TAK"){ if ( ile < 10 ){ ile++; cout << i << " "; } else if( x < 2 ){ ile++; cout << i << " "; } } } 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 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string s; int ile=0,x; for(int i = 1 ; i <= n; i++){ cin >> s >> x; if (ile < 20 && s == "TAK"){ if ( ile < 10 ){ ile++; cout << i << " "; } else if( x < 2 ){ ile++; cout << i << " "; } } } return 0; } |