水 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. Android 源码编译错误

    参考文章:http://blog.csdn.net/brightming/article/details/49763515/ Building with Jack: out/target/common ...

  2. SSDT Hook实现简单的进程隐藏和保护【转载】

    原文链接:http://www.blogfshare.com/ssdthook-hide-protect.html 原文作者:AloneMonkey SSDT Hook实现简单的进程隐藏和保护 Alo ...

  3. Hadoop 免密码登陆(ssh)

    record save here first [root@hadoop .ssh]# ssh-keygen -t rsa -P ''Generating public/private rsa key ...

  4. Class Methods & Variables

    When calling an instance method like withdraw_securely, the syntax generally looks something like th ...

  5. [BZOJ1659][Usaco2006 Mar]Lights Out 关灯

    [BZOJ1659][Usaco2006 Mar]Lights Out 关灯 试题描述 奶牛们喜欢在黑暗中睡觉.每天晚上,他们的牲口棚有L(3<=L<=50)盏灯,他们想让亮着的灯尽可能的 ...

  6. 暑假热身 B. 下载测速

    最近,nono终于结束了每年一次的为期12个月的冬眠,醒来的第一件事就是——看电影!!nono发现最近一年出现了各种很好很强大的电影,例如这个.这个.还有这个. 于是nono直接把这些电影全部扔进了下 ...

  7. 大数据之ETL设计详解

    ETL是BI项目最重要的一个环节,通常情况下ETL会花掉整个项目的1/3的时间,ETL设计的好坏直接关接到BI项目的成败.ETL也是一个长期的过程,只有不断的发现问题并解决问题,才能使ETL运行效率更 ...

  8. Android自定义Dialog

    Android开发过程中,常常会遇到一些需求场景——在界面上弹出一个弹框,对用户进行提醒并让用户进行某些选择性的操作, 如退出登录时的弹窗,让用户选择“退出”还是“取消”等操作. Android系统提 ...

  9. 【消息队列MQ】各类MQ比较

    目录(?)[-] RabbitMQ Redis ZeroMQ ActiveMQ JafkaKafka 目前业界有很多MQ产品,我们作如下对比: RabbitMQ 是使用Erlang编写的一个开源的消息 ...

  10. SSM框架Web程序的流程(Spring SpringMVC Mybatis)

    SSM框架的Web程序主要用到了三个技术: Spring:用到了注解和自动装配,就是Spring的两个精髓IOC(反向控制)和 AOP(面向切面编程). SpringMVC:用到了MVC模型,将逻辑代 ...