#include <cstdio> #include <string> using namespace std; int main() { int n = 20; scanf("%d", &n); int pointer = 0; for (int i = 1; i <= n; i++){ if (pointer == 20) break; char s[4] = ""; int x = 0; scanf(" %s %d", s, &x); if (s[0] == 'N') continue; if (pointer < 10) { pointer++; printf("%d ", i); } else { if (x >= 2) continue; pointer++; printf("%d ", 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 24 25 26 27 | #include <cstdio> #include <string> using namespace std; int main() { int n = 20; scanf("%d", &n); int pointer = 0; for (int i = 1; i <= n; i++){ if (pointer == 20) break; char s[4] = ""; int x = 0; scanf(" %s %d", s, &x); if (s[0] == 'N') continue; if (pointer < 10) { pointer++; printf("%d ", i); } else { if (x >= 2) continue; pointer++; printf("%d ", i); } } return 0; } |