http://codeforces.com/contest/63

A

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define lson l,mid,rt<<1
 4 #define rson mid+1,r,rt<<1|1
 5 #define sqr(x) ((x)*(x))
 6 #define pb push_back
 7 #define eb emplace_back
 8 #define maxn 1000006
 9 #define rep(k,i,j) for(int k=i;k<j;k++)
10 typedef long long ll;
11 typedef unsigned long long ull;
12 
13 struct sair{
14     string name,v;
15 }a[105];
16 
17 int main(){
18     #ifndef ONLINE_JUDGE
19         freopen("input.txt","r",stdin);
20     #endif
21     std::ios::sync_with_stdio(false);
22     int n;
23     cin>>n;
24     rep(i,1,n+1){
25         cin>>a[i].name>>a[i].v;
26     }
27     rep(i,1,n+1){
28         if(a[i].v=="rat"){
29             cout<<a[i].name<<endl;
30         }
31     }
32     rep(i,1,n+1){
33         if(a[i].v=="woman"||a[i].v=="child"){
34             cout<<a[i].name<<endl;
35         }
36     }
37     rep(i,1,n+1){
38         if(a[i].v=="man"){
39             cout<<a[i].name<<endl;
40         }
41     }
42     rep(i,1,n+1){
43         if(a[i].v=="captain"){
44             cout<<a[i].name<<endl;
45         }
46     }
47 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案