简单题,却犯了两个错误导致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. PHP获取域名、IP地址的方法

    本文介绍下,在php中,获取域名以及域名对应的IP地址的方法,有需要的朋友参考下. 在php中可以使用内置函数gethostbyname获取域名对应的IP地址,比如: 1 <?php 2 ech ...

  2. 标准c时间与日期函数

    标准c时间与日期函数 asctime 语法:     #include <time.h>   char *asctime( const struct tm *ptr ); 功能: 函数将p ...

  3. Java转C#,非常不错(转)

    http://www.cnblogs.com/cnwebman/archive/2012/07/21/2602436.html 最近正在研究将一个纯java工程如何转换成C#工程,代码量还比较大,于是 ...

  4. 04 Spring框架 依赖注入(一)

    整理了一下之前学习spring框架时候的一点笔记.如有错误欢迎指正,不喜勿喷. 上一节我们讲了几个bean的一些属性,用来限制我们实例创建过后的状态. 但是细心的我们会发现其实上面demo创建的实例并 ...

  5. 爬虫学习笔记(2)--创建scrapy项目&&css选择器

    一.手动创建scrapy项目---------------- 安装scrapy: pip install -i https://pypi.douban.com/simple/  scrapy    1 ...

  6. AJAX实现弹窗显示详情,全选和批量删除

    以Nation表为例,将Nation表显示在页面上,每一行数据前面加上复选框,后面加上查看详情,点击以弹窗形式显示每一行的数据,并且在表格最后一行加上全选复选框,点击选中全部数据,后面跟一个批量删除按 ...

  7. 学习小程序第三天 WXML语言特性

    WXML语言特性     1.数据绑定   Musstache 语法 获取json中指定键值:变量名加双括号的绑定语法 如下: (1)绑定文本 注意所有组件和属性 都要小写 (2)绑定属性     ( ...

  8. Rabbitmq消费失败死信队列

    Rabbitmq 重消费处理 一 处理流程图: 业务交换机:正常接收发送者,发送过来的消息,交换机类型topic AE交换机: 当业务交换机无法根据指定的routingkey去路由到队列的时候,会全部 ...

  9. php自带函数去除html标记

    strip_tags 去掉 HTML 及 PHP 的标记. 语法: string strip_tags(string str); 传回值: 字串 函式种类: 资料处理 内容说明 本函式可去掉字串中包含 ...

  10. OC_内存管理

      引言:      1.OC中的对象都是分配在堆中的                声明对象的格式:                     Person *person = [Person new ...