Codeforces Round #294 (Div. 2)
/*
水题
*/
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
using namespace std; const int maxn = 1e6 + 10;
int a[maxn]; int main(void)
{
//freopen ("A.in", "r", stdin); string s1;
int suma = 0; int sumb = 0;
for (int i=1; i<=8; ++i)
{
cin >> s1;
for (int j=0; s1[j]!='\0'; ++j)
{
if (s1[j] == '.') continue;
else if (s1[j] == 'Q') suma += 9;
else if (s1[j] == 'R') suma += 5;
else if (s1[j] == 'B') suma += 3;
else if (s1[j] == 'N') suma += 3;
else if (s1[j] == 'P') suma += 1;
else if (s1[j] == 'q') sumb += 9;
else if (s1[j] == 'r') sumb += 5;
else if (s1[j] == 'b') sumb += 3;
else if (s1[j] == 'n') sumb += 3;
else if (s1[j] == 'p') sumb += 1;
}
} if (suma > sumb) cout << "White" << endl;
else if (suma < sumb) cout << "Black" << endl;
else cout << "Draw" << endl; return 0;
}
水 B. A and B and Compilation Errors
题意:三组数列,依次少一个,找出少了的两个数
思路:
1. 三次排序,逐个对比(如果没找到,那个数在上一个数列的末尾)
2. 求和做差,最简单!
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std; const int maxn = 1e5 + 10;
int a[maxn];
int b[maxn];
int c[maxn]; int main(void)
{
//freopen ("B.in", "r", stdin); int n, x, y; while (~scanf ("%d", &n))
{
x = y = 0;
for (int i=1; i<=n; ++i)
{
scanf ("%d", &a[i]);
}
sort (a+1, a+1+n);
for (int i=1; i<=n-1; ++i)
{
scanf ("%d", &b[i]);
}
sort (b+1, b+1+n-1);
for (int i=1; i<=n-1; ++i)
{
if (a[i] == b[i]) continue;
else
{
x = a[i];
break;
}
}
if (x == 0) x = a[n];
for (int i=1; i<=n-2; ++i)
{
scanf ("%d", &c[i]);
}
sort (c+1, c+1+n-2);
for (int i=1; i<=n-2; ++i)
{
if (b[i] == c[i]) continue;
else
{
y = b[i];
break;
}
}
if (y == 0) y = b[n-1];
printf ("%d\n%d\n", x, y); } return 0;
} /*
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std; const int maxn = 1e5 + 10;
int a[maxn];
int b[maxn];
int c[maxn];
int suma, sumb, sumc; int main(void)
{
//freopen ("B.in", "r", stdin); int n; while (~scanf ("%d", &n))
{
suma = sumb = sumc = 0;
for (int i=1; i<=n; ++i)
{
scanf ("%d", &a[i]); suma += a[i];
}
for (int i=1; i<=n-1; ++i)
{
scanf ("%d", &b[i]); sumb += b[i];
}
for (int i=1; i<=n-2; ++i)
{
scanf ("%d", &c[i]); sumc += c[i];
} printf ("%d\n%d\n", suma - sumb, sumb - sumc);
} return 0;
}
*/
构造 C. A and B and Team Training
题意:方案:高手1和菜鸟2 或者 高手2菜鸟1 三人组队求最大组队数
思路:
1. 高手加菜鸟每三个分开,在n,m的数字之内
2. 高手多,高手2;菜鸟多,菜鸟2 比较好理解
#include <cstdio>
#include <algorithm>
using namespace std; int main(void)
{
//freopen ("C.in", "r", stdin); int n, m; while (~scanf ("%d%d", &n, &m))
{
int ans = (n + m) / 3;
ans = min (ans, n);
ans = min (ans, m);
printf ("%d\n", ans);
} return 0;
} /*
#include <cstdio>
#include <algorithm>
using namespace std; int main(void)
{
//freopen ("C.in", "r", stdin); int n, m; while (~scanf ("%d%d", &n, &m))
{
int cnt = 0;
while (n && m && (n + m) >= 3)
{
if (n >= m)
{
n -= 2; m -= 1;
}
else
{
n -=1; m -= 2;
}
cnt++;
} printf ("%d\n", cnt); return 0;
}
*/
Codeforces Round #294 (Div. 2)的更多相关文章
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings
题意: 对于26个字母 每个字母分别有一个权值 给出一个字符串,找出有多少个满足条件的子串, 条件:1.第一个字母和最后一个相同,2.除了第一个和最后一个字母外,其他的权和为0 思路: 预处理出sum ...
- Codeforces Round #294 (Div. 2)D - A and B and Interesting Substrings 字符串
D. A and B and Interesting Substrings time limit per test 2 seconds memory limit per test 256 megaby ...
- Codeforces Round #294 (Div. 2)C - A and B and Team Training 水题
C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #294 (Div. 2)B - A and B and Compilation Errors 水题
B. A and B and Compilation Errors time limit per test 2 seconds memory limit per test 256 megabytes ...
- Codeforces Round #294 (Div. 2)A - A and B and Chess 水题
A. A and B and Chess time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #294 (Div. 2) A and B and Lecture Rooms(LCA 倍增)
A and B and Lecture Rooms time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings [dp 前缀和 ]
传送门 D. A and B and Interesting Substrings time limit per test 2 seconds memory limit per test 256 me ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
随机推荐
- shell脚本步骤调试
第一种方式===> [root@localhost functions]# sh -x test.sh --check xx+ '[' --check '!=' -check ']'+ case ...
- sublime text多文件夹查找关键字
Ctrl+shift+F 快捷键在文件夹内查找,与普通编辑器不同的地方是sublime允许添加多个文件夹进行查找 转自:http://www.douban.com/note/362268947/
- RTX登录其他系统
前台: <html> <head> <title>签名验证</title> <meta http-equiv="Content-Lang ...
- poj 1328
http://poj.org/problem?id=1328 题意:题目大概意思就是有一群孤岛,想要用雷达来监视这些岛屿,但雷达的范围是有限的,所以需要多个雷达,题目就是要你解决最少需要几个雷达,注意 ...
- 57. 数对之差的最大值:4种方法详解与总结[maximum difference of array]
[本文链接] http://www.cnblogs.com/hellogiser/p/maximum-difference-of-array.html [题目] 在数组中,数字减去它右边的数字得到一个 ...
- [转]C程序内存区域分配(5个段作用)
[转]C程序内存区域分配(5个段作用) 2012-08-10 14:45:32| 分类: C++基础|字号 订阅 参考:http://www.360doc.com/content/11/03 ...
- ARM 处理器的几个相关术语
生产ARM的厂商很多,自然ARM处理器的名字就五花八门.但是,它们有些共同点,那就是:架构和核心. 架构这个概念太宽不太懂,一般不同的架构会有不同的指令集,在不同的架构下面还可以有多种核心.核心就是指 ...
- codeforces A. The Wall 解题报告
题目链接:http://codeforces.com/problemset/problem/340/A 这道题目理解不难,就是在[a, b]区间内,找出同时能够被x和y整除的个数.第一次想当然的开了两 ...
- mac os 显示文件列表命令 ls -a
显示正常文件列表用ls就行了,但是要是想显示隐藏的文件,需要加-a
- July 11th, Week 29th Monday, 2016
I want to win a trophy, it's the most important. 我希望获得冠军奖杯,这是最重要的事情. Win a trophy, stand on the very ...