#include <iostream>
#include <string>
using namespace std;
const int K = 10001;
int n, nrOfAttempts, firstTen, firstTwenty;
bool tab[K];
string isQualified;
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> isQualified >> nrOfAttempts;
if (isQualified == "TAK")
if (firstTen < 10) {
tab[i] = 1;
firstTen++;
firstTwenty++;
}
else if (firstTen >= 10 && nrOfAttempts < 2 && firstTwenty < 20) {
tab[i] = 1;
firstTwenty++;
}
}
for (int i = 0; i < n; i++)
if (tab[i] == 1)
cout << i + 1 << " ";
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 | #include <iostream> #include <string> using namespace std; const int K = 10001; int n, nrOfAttempts, firstTen, firstTwenty; bool tab[K]; string isQualified; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> isQualified >> nrOfAttempts; if (isQualified == "TAK") if (firstTen < 10) { tab[i] = 1; firstTen++; firstTwenty++; } else if (firstTen >= 10 && nrOfAttempts < 2 && firstTwenty < 20) { tab[i] = 1; firstTwenty++; } } for (int i = 0; i < n; i++) if (tab[i] == 1) cout << i + 1 << " "; return 0; } |
English