#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string s;
int m, k=0, x;
int main()
{
cin >> m;
for (int i = 0; i < m; i++)
{
cin >> s;
cin >> x;
if (s == "TAK")
{
if (k < 10)
{
cout << i + 1 << " ";
k++;
}
else if (x < 2)
{
cout << i + 1 << " ";
k++;
}
}
if (k == 20)
{
break;
}
}
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> #include <string> #include <algorithm> using namespace std; string s; int m, k=0, x; int main() { cin >> m; for (int i = 0; i < m; i++) { cin >> s; cin >> x; if (s == "TAK") { if (k < 10) { cout << i + 1 << " "; k++; } else if (x < 2) { cout << i + 1 << " "; k++; } } if (k == 20) { break; } } return 0; } |
English