#include<bits/stdc++.h> using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int ile1 = 10; int ile2 = 10; string czy; int x; for(int i = 1; i <= n && (ile1+ile2) > 0 ; i++){ cin >> czy; cin >> x; if(czy == "NIE" || ile1 == 0 && x >= 2){ continue; } else{ if(ile1 > 0){ ile1--; } else{ ile2--; } cout << i << " "; } } cout << "\n"; 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 26 27 28 29 30 31 32 | #include<bits/stdc++.h> using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int ile1 = 10; int ile2 = 10; string czy; int x; for(int i = 1; i <= n && (ile1+ile2) > 0 ; i++){ cin >> czy; cin >> x; if(czy == "NIE" || ile1 == 0 && x >= 2){ continue; } else{ if(ile1 > 0){ ile1--; } else{ ile2--; } cout << i << " "; } } cout << "\n"; return 0; } |