#include <iostream> using namespace std; int tab[20]; int main() { int n; cin>>n; string s; int x, y=0; for(int i=0; i<n; i++){ cin>>s>>x; if(y<21){ if((s=="TAK")&&(tab[9]==0)){ tab[y]=i+1; y++; } else if((s=="TAK")&&(tab[9]!=0)&&(x<2)){ tab[y]=i+1; y++; } } } for(int i=0; i<20; i++){ cout<<tab[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 25 26 27 28 29 30 31 32 33 | #include <iostream> using namespace std; int tab[20]; int main() { int n; cin>>n; string s; int x, y=0; for(int i=0; i<n; i++){ cin>>s>>x; if(y<21){ if((s=="TAK")&&(tab[9]==0)){ tab[y]=i+1; y++; } else if((s=="TAK")&&(tab[9]!=0)&&(x<2)){ tab[y]=i+1; y++; } } } for(int i=0; i<20; i++){ cout<<tab[i]<<" "; } return 0; } |