简单题,却犯了两个错误导致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大神的优美代码

最新文章

  1. RabbitMQ + PHP (三)案例演示
  2. HDU2842 矩阵乘法
  3. bootstrap-14
  4. Kindeditor为什么提交后获取不到值
  5. 让scrollView、tableView滚动到底部
  6. python set add 导致问题 TypeError: unhashable type: &#39;list&#39;
  7. IE和FF区别关于css和js
  8. BZOJ 3573 米特运输
  9. 利用netstat和tasklist查看PC的端口占用情况
  10. 在线预览pdf、xlsx、docx、ppt等文档
  11. request.getparam()与request.getAttibute()的区别
  12. MySQL调优三步曲(慢查询、explain profile)
  13. C#设计模式之十五命令模式(Command Pattern)【行为型】
  14. [LeetCode] Distribute Candies 分糖果
  15. [CQOI2016]伪光滑数
  16. Linux 内存清理
  17. PAT A1109 Group Photo (25 分)——排序
  18. securecrt配置经验总结(home.key和颜色)
  19. OnSen UI结合AngularJs打造”美团&quot;APP首页 --Hybrid Ap
  20. python与冒泡排序

热门文章

  1. Logstash简介
  2. C++语言的I/o使用方法详解
  3. python常用模块——random模块
  4. (转) GIS 中地理坐标和屏幕坐标的标准转换方法
  5. java实现文件的压缩和解压
  6. 生信概念之global alignment VS local alignment
  7. 七、golang中接口、反射
  8. 20145239《网络对抗》- 逆向及Bof基础实践
  9. iOS_触摸事件与手势识别
  10. 用vim写python脚本的自动缩进格式设置