水 A. A and B and Chess

/*
水题
*/
#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)的更多相关文章

  1. Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings

    题意: 对于26个字母 每个字母分别有一个权值 给出一个字符串,找出有多少个满足条件的子串, 条件:1.第一个字母和最后一个相同,2.除了第一个和最后一个字母外,其他的权和为0 思路: 预处理出sum ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. dedecms无法创建rss文件,提示DedeTag Engine Create File False

    最近有网友问dedecms无法创建rss文件提示:DedeTag Engine Create File False 这个提示一般出现以下情况才会出现:1.模板文件不存在,您可能误删除或者没有正确指定模 ...

  2. PHP随笔

    php(PHP开发) PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,易于学习,使用广泛 ...

  3. win7安装ubuntu后,进入不了win7

    方法一:进去ubuntu系统后,终端下输入如下命令:sudo update-grub,输入命令后,会提示寻找win7,ubuntu系统.并自动建立引导详情链接:http://zhidao.baidu. ...

  4. 【Spring】Spring系列4之Spring支持JDBC

    4.Spring支持JDBC 4.1.使用JdbcTemplate简化JDBC开发 也可以这么用(不推荐): 4.2.使用NamedParameterJdbcTemplate

  5. Binary Tree Level Order Traversal

    Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...

  6. First Position of Target

    For a given sorted array (ascending order) and a target number, find the first index of this number ...

  7. Django之admin界面恢复及添加数据模型

    引自:http://fl0wjacky.github.io/jekyll_demo/2014/07/14/Django-admin.html Django之admin界面恢复及添加数据模型 Djang ...

  8. JavaScript toFixed()使用的注意事项

    以下是w3school的定义: 定义和用法 toFixed() 方法可把 Number 四舍五入为指定小数位数的数字. 语法 NumberObject.toFixed(num) 参数 描述 num 必 ...

  9. 1.python基础入门

    作者:刘耀 出处:http://www.yaomr.com 欢迎转载 提示: 语法基于python3.5版本(会提示2.7版本和3.5版本的区别) Python命令行将以>>>开始, ...

  10. Win10手动添加开始磁铁

    1.移动到C:\Users\spring\AppData\Roaming\Microsoft\Windows\Start Menu\Programs 2.拖拽