/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> long n; int main() { std::cin >> n; char napis [10]; int ile_wczesniej; long ile_bylo=0; for(long i=0; i<n; i++) { std::cin >> napis >> ile_wczesniej; if (napis[0]=='T' && napis[1]=='A' && napis[2]=='K') { if (ile_bylo < 10) { std::cout << i+1 << " "; ile_bylo++; } else if (ile_bylo < 20 && ile_wczesniej <2) { std::cout << i+1; if(ile_bylo < 19) std::cout << " "; ile_bylo++; } } } 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 34 35 36 37 38 39 40 41 42 | /****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> long n; int main() { std::cin >> n; char napis [10]; int ile_wczesniej; long ile_bylo=0; for(long i=0; i<n; i++) { std::cin >> napis >> ile_wczesniej; if (napis[0]=='T' && napis[1]=='A' && napis[2]=='K') { if (ile_bylo < 10) { std::cout << i+1 << " "; ile_bylo++; } else if (ile_bylo < 20 && ile_wczesniej <2) { std::cout << i+1; if(ile_bylo < 19) std::cout << " "; ile_bylo++; } } } return 0; } |