#include<iostream> #include<string> int main(){ std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int zawodnicy[20]; std::string s; int x, liczba_uczestnikow; std::cin>>liczba_uczestnikow; int j=0; for(int i = 1; i<=liczba_uczestnikow; i++){ std::cin>>s>>x; if(s=="TAK" && j<20 && (j<10 || x<2)){ zawodnicy[j] = i; j++; } } for(int i =0;i<20;i++){ std::cout<<zawodnicy[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 | #include<iostream> #include<string> int main(){ std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int zawodnicy[20]; std::string s; int x, liczba_uczestnikow; std::cin>>liczba_uczestnikow; int j=0; for(int i = 1; i<=liczba_uczestnikow; i++){ std::cin>>s>>x; if(s=="TAK" && j<20 && (j<10 || x<2)){ zawodnicy[j] = i; j++; } } for(int i =0;i<20;i++){ std::cout<<zawodnicy[i]<<" "; } return 0; } |