#include <iostream> int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0); int n, qua=0, fin; std::string yes; std::cin >> n; for (int i=1; i<=n; i++) { std::cin >> yes >> fin; if (qua<10) { if (yes=="TAK") { std::cout << i << ' '; qua++; } } else if (qua<20) { if ((yes=="TAK") and (fin<2)) { std::cout << i << ' '; qua++; } } else { break; } } std::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 | #include <iostream> int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0); int n, qua=0, fin; std::string yes; std::cin >> n; for (int i=1; i<=n; i++) { std::cin >> yes >> fin; if (qua<10) { if (yes=="TAK") { std::cout << i << ' '; qua++; } } else if (qua<20) { if ((yes=="TAK") and (fin<2)) { std::cout << i << ' '; qua++; } } else { break; } } std::cout << '\n'; return 0; } |