Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)
2015-01-21 20:23
429 查看
简单题,却犯了两个错误导致WA了多次。
第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的。。。
二是chronologically这个词没注意,其实如果输入是按时间顺序的,就直接在线处理就行了,用不着int team1[110][110],team2[110][110]两个数组。
BigBag大神的优美代码
第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的。。。
二是chronologically这个词没注意,其实如果输入是按时间顺序的,就直接在线处理就行了,用不着int team1[110][110],team2[110][110]两个数组。
#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 = 111, inf = 1111111111; int n, f[2][max_n]; string a[2]; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); cin >> a[0] >> a[1] >> n; while (n--) { int t, num, q, c; char c1, c2; cin >> t >> c1 >> num >> c2; if (c1 == 'h') { q = 0; } else { q = 1; } if (c2 == 'y') { c = 1; } else { c = 2; } if (f[q][num] < 2) { f[q][num] += c; if (f[q][num] >= 2) { cout << a[q] << " " << num << " " << t << endl; } } } return 0; }
BigBag大神的优美代码
相关文章推荐
- Codeforces Round #281 (Div. 2) A. Vasya and Football 模拟
- Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题
- Codeforces Round #281 (Div. 2) A. Vasya and Football
- Codeforces Round #281 (Div. 2) A - Vasya and Football
- Codeforces Round #381 (Div. 2) C. Alyona and mex(模拟)
- 【CF1073B】Vasya and Books(模拟)
- Codeforces #324 Div2 C Marina and Vasya(构造)
- Codeforces Round #393 (Div. 2) - B. Frodo and pillows(模拟)
- Codeforces Round #354 (Div. 2)——C. Vasya and String(尺取)
- Codeforces Round #369 (Div. 2) B. Chris and Magic Square【数学,模拟】
- Codeforces Round #206 (Div. 2) C-Vasya and Robot
- Codeforces Round #354 (Div. 2) C. Vasya and String
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题
- Codeforces Round #324 (Div. 2) C. Marina and Vasya
- A Vasya and Football
- 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root
- Codeforces Round #395(Div. 2)B. Timofey and cubes【模拟】
- Codeforces Round #444 (Div. 2)_D. Ratings and Reality Shows_模拟
- 【2-SAT】Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) D. Innokenty and a Football League
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论