A Vasya and Football

一开始跪了一发,

注意一个坑:题目中好像没有说明不会出现重复红牌、多黄牌的情况;需要进行排除;

本人是这里加了判断: if((t2[0]==‘r‘ || f1[number]==2) && f1[number]<=2)  之后过的。

AC Code:

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <math.h>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <map>
using namespace std;
#define LL long long
#define sf(a) scanf("%d",&(a));
#define N 35
char name1[N],name2[N];
int f1[10010],f2[10010];
int main()
{
    scanf("%s %s",name1,name2);
    int n;
    scanf("%d",&n);
    while(n--){
        char t1[N],t2[N];
        int t,number;
        scanf("%d %s %d %s",&t,t1,&number,t2);
        if(t1[0]==‘h‘){
            //主场
            f1[number]++;
            if((t2[0]==‘r‘ || f1[number]==2) && f1[number]<=2)
            {
                f1[number] = 3;
                printf("%s %d %d\n",name1,number,t);
            }
        }else{
            f2[number]++;
            if((t2[0]==‘r‘ || f2[number]==2) && f2[number]<=2){
                f2[number]=3;
                printf("%s %d %d\n",name2,number,t);
            }
        }

    }
    return 0;
}
时间: 2024-10-23 04:51:55

A Vasya and Football的相关文章

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) A. Vasya and Football(模拟)

简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词没注意,其实如果输入是按时间顺序的,就直接在线处理就行了,用不着int team1[110][110],team2[110][110]两个数组. #include<iostream> #include<cstdio> #include<cstdlib> #include&l

Codeforces Round #281 (Div. 2) 解题报告 A.B.C.D.

A - Vasya and Football 纯模拟..比较坑的是会有不符合足球常识的地方.. 代码如下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #inc

codeforces 493 ABCD

A. Vasya and Football A. Vasya and Football time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Vasya has started watching football games. He has learned that for some fouls the players receiv

Codeforces Round #281 (Div. 2) (A、B、C、D题)

昨天这场CF打的还挺爽的,不过就是没咋涨Rating,没把握好涨Rating的机会.. 本来可以过四题的,,但是很失败,重评后跪了两道..唉:-( A. Vasya and Football 思路:给每个人计数,黄牌+1,红牌+2. 当数字第一次超过2时输出. 题目链接:A. Vasya and Football AC代码: #include <cstdio> #include <cstring> #include <iostream> #include <alg

CF43A Football

CF43A Football 题意翻译 题目大意 两只足球队比赛,现给你进球情况,问哪支队伍赢了. 第一行一个整数nn (1\leq n\leq 1001≤n≤100 ),表示有nn 次进球,接下来nn 行,每行一个长度不超过1010 ,只由大写字母组成的字符串,表示一个进球的球队名,保证只有两个球队. 输出一个字符串表示胜利球队的球队名,不会平局. Translated by Khassar 题目描述 One day Vasya decided to have a look at the re

POJ 3071 Football

Description Consider a single-elimination football tournament involving 2n teams, denoted 1, 2, -, 2n. In each round of the tournament, all teams still in the tournament are placed in a list in order of increasing index. Then, the first team in the l

codeforces 584C Marina and Vasya

C. Marina and Vasya Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string. More formally, you are given two strings s1, s2 of length

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