#include <stdio.h>
#include <vector>
using namespace std;
int main() {
int n;
char s[13];
scanf("%d" ,&n);
vector<int> ret;
for (int i = 1; i <= n; i++) {
int x;
scanf("%s %d", s, &x);
if (s[0] == 'N') continue;
if (ret.size() < 10) {
ret.push_back(i);
continue;
}
if (x < 2) ret.push_back(i);
}
int u = 20;
if (ret.size() < u) u = ret.size();
for (int i = 0; i < u; i++) printf("%d ", ret[i]);
printf("\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 | #include <stdio.h> #include <vector> using namespace std; int main() { int n; char s[13]; scanf("%d" ,&n); vector<int> ret; for (int i = 1; i <= n; i++) { int x; scanf("%s %d", s, &x); if (s[0] == 'N') continue; if (ret.size() < 10) { ret.push_back(i); continue; } if (x < 2) ret.push_back(i); } int u = 20; if (ret.size() < u) u = ret.size(); for (int i = 0; i < u; i++) printf("%d ", ret[i]); printf("\n"); return 0; } |
English