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 ...
随机推荐
- Unity3D研究之Prefab里面的Prefab关联问题
Unity研究院之Prefab和GameObject的正向和逆向查找引用 我发现很多美工兄弟都爱问程序Unity3d为什么总丢材质? 我不排除U3d有BUG的情况下会丢材质?但是其实很多时候是人为操作 ...
- Android计时器实例
布局文件 <Chronometer android:id="@+id/chronometer" android:layout_width="wrap_content ...
- 极客教学:如何使用树莓派击落&劫持无人机
本教程的目的是帮助大家理解如何研究未受保护的无线通信的安全风险所在,同时我们希望大家不要对技术进行滥用.我们这里采用的例子是一个流行的无人机模型:Parrot AR.Drone 2.0. 四轴无人机能 ...
- Tor
参考: http://www.douban.com/group/topic/67555786/ http://blog.sina.com.cn/s/blog_72a7ac670101km46.html ...
- Cocos2d-x 学习资料推荐
最近在看Cocos2d-x ,官网的资料太少了,下面推荐一些比较好的教程,不断更新中. 1. cocos2d-x高级开发教程 如果你懂得objective-c 那么一定要看看这本书,这里面有许多C++ ...
- iOS 和Android中的基本日期处理
提到日期处理,主要有2个参数,一个是所在的时区,一个是所用的日历方法. 主要涉及2大类问题,一类是日期类型和字符串之间的转化,另一类是日期的计算问题.ios和android都提供了相应的类来处理问题. ...
- 利用FFmpeg生成视频缩略图 2.1.6
利用FFmpeg生成视频缩略图 1.下载FFmpeg文件包,解压包里的\bin\下的文件解压到 D:\ffmpeg\ 目录下. 下载地址 http://ffmpeg.zeranoe.com/build ...
- codeforces B. Eight Point Sets 解题报告
题目链接:http://codeforces.com/problemset/problem/334/B 一开始看到题目,有点怯,理解了题目后,其实并不难.这句话是突破口 three distinct ...
- PHP--TP框架----操作数据库
//操作数据库 //$attr = $m->select(); //查询所有数据 //$attr = $m->s ...
- [Android Pro] 通过IMSI判断手机是移动、联通、电信
TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); /** 获取 ...