简单题,却犯了两个错误导致WA了多次。

第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的。。。

二是chronologically这个词没注意,其实如果输入是按时间顺序的,就直接在线处理就行了,用不着int team1[110][110],team2[110][110]两个数组。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<cctype>
#include<sstream>
using namespace std;
#define pii pair<int,int>
#define LL long long int
const int eps=1e-;
const int INF=;
const int maxn=+;
char t1[],t2[];
int n,t,m;
int team1[][],team2[][];
int r1[],r2[];
char team,card;
int main()
{
//freopen("in2.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%s%s",t1,t2);
scanf("%d",&n);
for(int i=; i<n; i++)
{
scanf("%d",&t);
getchar();
scanf("%c",&team);
getchar();
scanf("%d",&m);
getchar();
scanf("%c",&card);
getchar();
if(team=='a')
{
if(card=='y')
{
r2[m]++;
if(r2[m]==)
team2[t][m]=;
}
else
{
if(r2[m]<)
{
r2[m]=;
team2[t][m]=;
}
}
}
else
{
if(card=='y')
{
r1[m]++;
if(r1[m]==)
team1[t][m]=;
}
else
{
if(r1[m]<)
{
r1[m]=;
team1[t][m]=;
}
}
}
}
for(int i=; i<=; i++)
{
for(int j=; j<=; j++)
{
if(team1[i][j]==)
{
printf("%s %d %d\n",t1,j,i);
break;
}
else if(team2[i][j]==)
{
printf("%s %d %d\n",t2,j,i);
break;
}
}
}
//fclose(stdin);
//fclose(stdout);
return ;
}

我的渣代码

#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm> using namespace std; const int max_n = , inf = ; int n, f[][max_n];
string a[]; int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin >> a[] >> a[] >> n;
while (n--) {
int t, num, q, c;
char c1, c2;
cin >> t >> c1 >> num >> c2;
if (c1 == 'h') {
q = ;
} else {
q = ;
}
if (c2 == 'y') {
c = ;
} else {
c = ;
}
if (f[q][num] < ) {
f[q][num] += c;
if (f[q][num] >= ) {
cout << a[q] << " " << num << " " << t << endl;
}
}
}
return ;
}

BigBag大神的优美代码

Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)的更多相关文章

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

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  2. 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 foul ...

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

    B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ...

  4. Codeforces Round #281 (Div. 2) D. Vasya and Chess 水

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  6. Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  8. 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 ...

  9. 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 te ...

随机推荐

  1. List contents of directories in a tree-like format

    Python programming practice. Usage: List contents of directories in a tree-like format. #!/usr/bin/p ...

  2. django-admin 设计User外键,设计model

    设置外键 class profile_user(AbstractBaseUser, PermissionsMixin): company = models.ForeignKey(Company, de ...

  3. 佳能相机操作 EDSDK 教程 C# 版本

    http://blog.csdn.net/zajin/article/details/17021339    介绍 佳能EOS数码SDK是一个 可以用来远程控制其数码单反相机相当强大的SDK.不幸的是 ...

  4. Parquet and ORC

    http://dongxicheng.org/mapreduce-nextgen/columnar-storage-parquet-and-orc/ 相比传统的行式存储引擎,列式存储引擎具有更高的压缩 ...

  5. windows简单使用etcd

    一.下载安装选择版本 https://github.com/coreos/etcd/releases 二.解压 三.首先开启etcd 1.进入在etcd解压的目录中 2.etcd.exe 没有erro ...

  6. mongodb GridFS django FileFiled 默认 widget 只有一个文件上传框显示不了字段内容,重写widget

    首先,定位到:FileFiled 默认 widget 源码:mongoadmin包options.py中,如下: # Defaults for formfield_overrides. ModelAd ...

  7. linux下pycharm的使用

    百度搜索pycharm 然后打开pycharm的官网 然后在官网首页点击down   如果使用的是Linux系统,那么默认已经选择Linux版本 左边的down是全功能的IDE和WEB扩展,属于商业版 ...

  8. IDEA配置文件的保存目录

    IntelliJ IDEA 的实时代码模板保存在 /templates 目录下,其他系统目录位置如下:(因为目录名在各个系统上是一致的,建议用硬盘搜索工具搜索即可) Windows: . Linux: ...

  9. docker官方镜像库 搭建 jekins

    先去docker hub 镜像官网下载jenkins 镜像(https://hub.docker.com/_/jenkins/): 其实就是在docker 中执行命令:docker pull jenk ...

  10. C#将字符转换成utf8编码 GB321编码转换

    public static string get_uft8(string unicodeString) { UTF8Encoding utf8 = new UTF8Encoding(); Byte[] ...