Codeforces Round #313 (Div. 2) ABC
A
http://codeforces.com/contest/560/problem/A
推断给出的数能否组成全部自然数。
水题
int a[1010];
bool b[1000010];
int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
memset(b,false,sizeof(b));
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
b[a[i]] = true;
}
int ans = 0;
if (b[1] == false) ans = 1;
else if (b[1]) ans = -1;
printf("%d\n",ans);
}
return 0;
}
B
http://codeforces.com/contest/560/problem/B
推断一个矩形能否装下另外两个矩形
int a1, a2, a3, b1, b2, b3;
int main()
{
while (scanf("%d%d%d%d%d%d", &a1, &b1, &a2, &b2, &a3, &b3) != EOF)
{
int ok = 0;
int t1 = max(b2, b3);
int r1 = max(a2, a3);
if ((t1 <= a1 && (a2 + a3) <= b1)) ok = 1;
if ((t1 <= b1 && (a2 + a3) <= a1)) ok = 1;
if ((r1 <= a1 && (b2 + b3) <= b1)) ok = 1;
if ((r1 <= b1 && (b2 + b3) <= a1)) ok = 1;
int t11 = max(b2, a3);
int r11 = max(a2, b3);
if ((r11 <= a1 && (b2 + a3) <= b1)) ok = 1;
if ((r11 <= b1 && (b2 + a3) <= a1)) ok = 1;
if ((t11 <= a1 && (a2 + b3) <= b1)) ok = 1;
if ((t11 <= b1 && (a2 + b3) <= a1)) ok = 1;
if (ok) puts("YES");
else puts("NO");
}
return 0;
}
C
http://codeforces.com/contest/560/problem/C
推断组成六边形须要的三角形个数
int a, b, c, d, e, f;
int main()
{
while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF)
{
printf("%d\n", (a + b + c)*(a + b + c) - (a*a + c*c + e*e));
}
return 0;
}
Codeforces Round #313 (Div. 2) ABC的更多相关文章
- 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 #247 (Div. 2) ABC
Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431 代码均已投放:https://github.com/illuz/Wa ...
- Codeforces Round #313 (Div. 1)
官方英文题解:http://codeforces.com/blog/entry/19237 Problem A: 题目大意: 给出内角和均为120°的六边形的六条边长(均为正整数),求最多能划分成多少 ...
- dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
Gerald and Giant Chess Problem's Link: http://codeforces.com/contest/559/problem/C Mean: 一个n*m的网格,让你 ...
- Codeforces Round #313 (Div. 1) B. Equivalent Strings
Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...
- Codeforces Round #313 (Div. 2)B.B. Gerald is into Art
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/ ...
- Codeforces Round #313 (Div. 2) D. Equivalent Strings
D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学
C. Gerald's Hexagon Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/pr ...
随机推荐
- Leetcode1--->数组中两数之和等于给定数
题目: 给定一个数组nums,目标数target.在数组中找到两数之和为target的数,返回两数的下标举例: Given nums = [2, 7, 11, 15], target = 9, Bec ...
- match_parent, wrap_content, 和 fill_parent 区别联系
fill_parent -1 The view should be as big as its parent (minus padding). This constant is deprecat ...
- Python的内存管理、命名规则、3个特性讲解
理解变量: 变:现实世界中的状态是会发生改变的 量:衡量/记录现实世界中的状态,让计算机能够像人一样去识别世间万物(例如:一个人的身高.体重等这些信息) 为什么要变量: 程序执行的本质就是一系列状态的 ...
- List容器——ArrayList及常用API
List: ① List容器是有序的collection(也称为序列).此接口的用户可以对List容器中每个元素的插入位置进行精确地控制.用户可以根据元素的整数索引(在列表中的位置)访问元素,并搜 ...
- Timer和TimerTask详解
1.概览 Timer是一种定时器工具,用来在一个后台线程计划执行指定任务.它可以计划执行一个任务一次或反复多次.TimerTask一个抽象类,它的子类代表一个可以被Timer计划的任务. 简单的一个例 ...
- PHP杂技(二)
php array_merge($a,$b)与 $a+$b区别 array_merge 数字键名会被重新编号,what's '...' $data = [[1, 2], [3], [4, 5]]; v ...
- NOJ——1508火烧赤壁2(并查集+启发式合并+逆序加边)
[1508] 火烧赤壁2 时间限制: 1000 ms 内存限制: 65535 K 问题描述 上次出了一道火烧赤壁的题目给当时的新生,也就是你们的上一届学长们做,那么这次,我又想到了另一个想法. 上次的 ...
- BZOJ 4817 [Sdoi2017]树点涂色 ——LCT 线段树
同BZOJ3779. SDOI出原题,还是弱化版的. 吃枣药丸 #include <map> #include <cmath> #include <queue> # ...
- 刷题总结——Human Gene Functions(hdu1080)
题目: Problem Description It is well known that a human gene can be considered as a sequence, consisti ...
- APUE 学习笔记(十) 高级I/O
1. Unix IPC(InterProcess Communication) 同一主机的各个进程间的IPC:管道.FIFO.消息队列.信号量.共享存储器 不同主机上的各个进程间IPC:socket套 ...