水 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. SGU 179 Brackets light(生成字典序的下一个序列)

    题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=179 解题报告:输入一个合法的括号串,求出这个括号串的字典序的下一个串.(认为'(' ...

  2. [codeforces 260]B. Ancient Prophesy

    [codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain th ...

  3. Linux 系统安全 抵御TCP的洪水

    抵御TCP的洪水 分类: LINUX tcp_syn_retries :INTEGER默认值是5对 于一个新建连接,内核要发送多少个 SYN 连接请求才决定放弃.不应该大于255,默认值是5,对应于1 ...

  4. 经典的SQL面试题

    SQL中 inner join. left join .right join. outer join之间的区别 A表(a1,b1,c1) B表(a2,b2) a1 b1 c1 a2 b2 01 数学 ...

  5. 【Hadoop】Hive HSQ 使用 && 自定义HQL函数

    4 HQL 4.1 官网 4.1.1 https://cwiki.apache.org/confluence/display/Hive/LanguageManual 4.1.2 性能调优 4.1.2. ...

  6. Spring配置JNDI的解决方案

    我的配置环境是:Spring + Tomcat + MySql 说明: 1. $TOMCAT_HOME代表Tomcat的安装目录. 第一步:在Tomcat的$TOMCAT_HOME/conf/cont ...

  7. CSDN客户端实现

    本文主要讲解实现了一个CSDN的安卓客户端,主要知识点如下 java爬虫获取网页数据 将java程序打包成jar包 Fragment+viewpager+TabPageIndicator实现Tab效果 ...

  8. mysql 主主复制(双主复制)+ 配置KEEPALIVED实现热备

    binlog-do-db和replicate-do-db表示需要同步的数据库 binlog-ignore-db和replicate-ignore-db表示不需要同步的数据库 云端服务器为master配 ...

  9. C#开发微信公众平台-就这么简单(附Demo)(转载)

    转载地址:http://www.cnblogs.com/xishuai/p/3625859.html 写在前面 服务号和订阅号 URL配置 创建菜单 查询.删除菜单 接受消息 发送消息(图文.菜单事件 ...

  10. linux tricks 之 bitmap分析.

    ------------------------------------------- 本文系作者原创, 欢迎大家转载! 转载请注明出处:netwalker.blog.chinaunix.net -- ...