首页 > 其他 > 详细

codeforces#281 A

时间:2014-12-04 11:51:17      阅读:290      评论:0      收藏:0      [点我收藏+]

脑子有点秀逗

bubuko.com,布布扣
 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 #include<cmath>
 6 using namespace std;
 7 int teama[120]={0};
 8 int teamb[120]={0};
 9 int main()
10 {
11     string away,home;
12     cin>>home>>away;
13     int n;
14     cin>>n;
15     for(int i=0;i<n;i++)
16     {
17         int nu,time;
18         string ca,peo;
19         cin>>time>>peo>>nu>>ca;
20         if(peo=="h"){
21             if(ca=="r"&&teama[nu]!=-1){
22                 cout<<home<<" "<<nu<<" "<<time<<endl;
23                 teama[nu]=-1;
24             }
25             if(ca=="y"){
26                 if(teama[nu]==1){
27                     cout<<home<<" "<<nu<<" "<<time<<endl;
28                     teama[nu]=-1;
29                 }
30                 if(teama[nu]!=-1)
31                 teama[nu]++;
32             }
33         }
34         else{
35             if(ca=="r"&&teamb[nu]!=-1){
36                 cout<<away<<" "<<nu<<" "<<time<<endl;
37                 teamb[nu]=-1;
38             }
39             if(ca=="y"){
40                 if(teamb[nu]==1)
41                 {
42                     cout<<away<<" "<<nu<<" "<<time<<endl;
43                     teamb[nu]=-1;
44                 }
45                 if(teamb[nu]!=-1)
46                     teamb[nu]++;
47             }
48         }
49     }
50     return 0;
51 }
View Code

 

codeforces#281 A

原文:http://www.cnblogs.com/vactor/p/4142298.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!