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 ...
随机推荐
- Python socket套字节
套接字socket标准:位于:应用层--(socket抽象层)--传输层 之间 #Servre import socket phone=socket.socket(socket.AF_INET,soc ...
- request.getHeader("referer")
在开发web程序的时候,有时我们需要得到用户是从什么页面连过来的,这就用到了referer. 它是http协议,所以任何能开发web程序的语言都可以实现,比如jsp中是: request.getHea ...
- POJ 1953 World Cup Noise
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14397 Accepted: 7129 ...
- HashMap源码分析jdk1.6
HashMap数组每个元素的初始值为NULL 1.定义 public interface Map<K,V> { int size(); boolean isEmpty(); boolea ...
- 【bzoj2225】[Spoj 2371]Another Longest Increasing CDQ分治+树状数组
题目描述 给定N个数对(xi, yi),求最长上升子序列的长度.上升序列定义为{(xi, yi)}满足对i<j有xi<xj且yi<yj. 样例输入 8 1 3 3 2 1 1 4 5 ...
- input和textarea区别
1. input是单行文本,textarea是多行文本,可以带滚动条2. input的value放在标签里面 <input type="text" value="b ...
- [APIO2015] 雅加达的摩天楼 (分块,最短路)
题目链接 Solution 分块+\(Dijkstra\). 难点在于建边,很明显 \(O(n^2)\) 建边会挂一堆 . 那么考虑一下, \(n^2\) 建边多余的是哪些东西 \(???\) 很显然 ...
- TransactionProxyFactoryBean 配置问题
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- python并发之concurrent.futures
concurrent:并发 Python标准库为我们提供了threading和multiprocessing模块编写相应的多线程/多进程代码.从Python3.2开始,标准库为我们提供了concurr ...
- bzoj 1069 凸包+旋转卡壳
题目大意 在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成 的多边形面积最大. 分析 枚举对角线的一个端点 另一个端点开始转 转的时候求出对角线左边面积 ...