#include <iostream>
#include <string>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
unsigned short n;
std::cin >> n;
int topTen[10];
int index10 = 0;
int tenToTwenty[10];
int index20 = 0;
for(unsigned short i = 0; i < n; i++)
{
std::string canPlayInFinal;
unsigned short pastFinals;
std::cin >> canPlayInFinal >> pastFinals;
if(index20==10 || canPlayInFinal != "TAK"){
continue;
}
if(index10<10){
topTen[index10] = i+1;
index10++;
continue;
}
if(pastFinals <= 1){
tenToTwenty[index20] = i+1;
index20++;
}
}
for(int i = 0; i<20;i++){
std::cout << (i<10 ? topTen[i] : tenToTwenty[i-10]) << " ";
}
}
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 34 35 36 37 38 39 40 | #include <iostream> #include <string> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); unsigned short n; std::cin >> n; int topTen[10]; int index10 = 0; int tenToTwenty[10]; int index20 = 0; for(unsigned short i = 0; i < n; i++) { std::string canPlayInFinal; unsigned short pastFinals; std::cin >> canPlayInFinal >> pastFinals; if(index20==10 || canPlayInFinal != "TAK"){ continue; } if(index10<10){ topTen[index10] = i+1; index10++; continue; } if(pastFinals <= 1){ tenToTwenty[index20] = i+1; index20++; } } for(int i = 0; i<20;i++){ std::cout << (i<10 ? topTen[i] : tenToTwenty[i-10]) << " "; } } |
English