codeforces#281 A

脑子有点秀逗

 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 }

时间: 2024-10-10 15:42:13

codeforces#281 A的相关文章

CodeForces 281 题解

A题: 题意:给出按照时间顺序的比赛记录,比赛记录了哪一分钟有哪位球员得到了黄牌或红牌,输出罚下的人的序列. 题解:直接按照时间读入模拟就可..注意坑在有可能一位球员罚下后又得到黄牌或红牌,这时候不应再输出这个人了. B题: 题意:给出两个摔跤选手每个动作的得分,正数为第一个人得分负数为第二个人得分,总分高者胜,若相同则“字典序”较大的获胜,再相同则最后得分的人获胜. 题解:直接模拟就可..要用long long.. C题: 题意:两个队伍篮球比赛,给出每个队伍投进的每个球距离球框的距离,现在要

Codeforces Round #281 (Div. 2) a

/**  * @brief Codeforces Round #281 (Div. 2) a  * @file a.cpp  * @author 面码  * @created 2014/12/04 17:49  * @edited  2014/12/04 17:58  * @type  implementation  *  */ #include <iostream> #include <fstream> #include <cstdlib> #include <

Codeforces Round #281 (Div. 2) b

/**  * @brief Codeforces Round #281 (Div. 2) b  * @file b.cpp  * @author 面码  * @created 2014/12/04 18:40  * @edited  2014/12/04 18:40  * @type  implementation  *  */ #include <iostream> #include <fstream> #include <cstdlib> #include <

Codeforces Round #281 (Div. 2) d

/**  * @brief Codeforces Round #281 (Div. 2) d  * @file d.cpp  * @author 闈㈢爜  * @created 2014/12/05 18:19  * @edited  2014/12/05 18:19  * @type  game  *  */ #include <iostream> #include <fstream> #include <cstdlib> #include <stack>

Codeforces Round #281 (Div. 2) c

/**  * @brief Codeforces Round #281 (Div. 2) c  * @file c.cpp  * @author 面码  * @created 2014/12/05 11:54  * @edited  2014/12/05 11:54  * @type  brute  *  */ #include <iostream> #include <fstream> #include <cstdlib> #include <stack>

Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力

A. Vasya and Football Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red

Codeforces Round #281 (Div. 2) C. Vasya and Basketball 排序

C. Vasya and Basketball Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from does

Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题

B. Vasya and Wrestling Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins. When the numbers of points of both wrestlers are equal, th

Codeforces Round #281 (Div. 2) D. Vasya and Chess 博弈

D. Vasya and Chess Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess. The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell is