第一题想当然了,结果被坑。。

有1的肯定能构成所有的其他数,没有1的肯定构不成1 ,这题T T

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n, arr;
int tag = ;
scanf("%d", &n);
for(int i = ; i < n; ++i) {
scanf("%d", &arr);
tag = (arr == || tag == ) ? : ;
}
if(tag) cout << - << endl;
else cout << << endl;
return ;
}

第二题,就是考虑的边界有点多。

#include<bits/stdc++.h>
using namespace std;
int main() {
int b[];
int p1[], p2[];
cin >> b[] >> b[] >> p1[] >> p1[] >> p2[] >> p2[];
sort(b, b+); sort(p1, p1+); sort(p2, p2+);
if((p1[] * p1[] + p2[] * p2[]) > (b[] * b[]) || p2[] > b[] || p1[] > b[] ) {
cout << "NO" << endl;
} else {
int tag = ;
int x[];
x[] = b[] - p1[];
x[] = b[] - p1[];
x[] = b[] - p1[];
x[] = b[] - p1[]; if(p2[] <= min(x[], b[]) && p2[] <= max(x[], b[]))
tag = ; //cout << 1 << endl;
else if (p2[] <= min(x[], b[]) && p2[] <= max(x[], b[]))
tag = ; //cout << 2 << endl;
else if(p2[] <= min(x[], b[]) && p2[] <= max(x[], b[]))
tag = ; //cout << 3 << endl;
else if(p2[] <= min(x[], b[]) && p2[] <= max(x[], b[]))
tag = ; //cout << 4 << endl; cout << x[3] << b[1] << endl;
if(tag)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return ;
}

第三题,就是算个等角六边形的面积,可以补成大矩形算,也可以补成大正三角形算。用分割的方法反而复杂许多,而且还遇到精度丢失问题

#include <bits/stdc++.h>
using namespace std; int main() {
int a[];
for(int i = ; i < ; ++i)
cin >> a[i];
cout << (a[] + a[] + a[])*(a[] + a[] + a[])-a[] * a[] - a[] * a[] - a[] * a[] << endl;
return ;
}

CodeForces Round#313的更多相关文章

  1. Codeforces Round #313 (Div. 1)

    官方英文题解:http://codeforces.com/blog/entry/19237 Problem A: 题目大意: 给出内角和均为120°的六边形的六条边长(均为正整数),求最多能划分成多少 ...

  2. 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的网格,让你 ...

  3. Codeforces Round #313 (Div. 1) B. Equivalent Strings

    Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...

  4. Codeforces Round #313 (Div. 1) A. Gerald's Hexagon

    Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...

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

  6. Codeforces Round #313 (Div. 2) D. Equivalent Strings

    D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...

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

  8. Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

    A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...

  9. Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess (Lucas + dp)

    题目链接:http://codeforces.com/contest/560/problem/E 给你一个n*m的网格,有k个坏点,问你从(1,1)到(n,m)不经过坏点有多少条路径. 先把这些坏点排 ...

  10. Codeforces Round #313 (Div. 1) B. Equivalent Strings DFS暴力

    B. Equivalent Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559 ...

随机推荐

  1. Linux下长时间ping网络加时间戳并记录到文本

    Linux下长时间ping网络加时间戳并记录到文本   由于一些原因,比如需要检查网络之间是否存在掉包等问题,会长时间去ping一个地址,由于会输出大量的信息而且最好要有时间戳,因此我们可以使用简单的 ...

  2. 解决ArcGIS安装之后出现的Windows installer configures问题

    ----Please wait while Windows installer configures ArcGIS Desktop Error Message错误信息 When launching A ...

  3. 高版本api在低版本中的兼容

    直接上例子,看如何避免crash. eg:根据给出路径,获取此路径所在分区的总空间大小. 文档说明:获取文件系统用量情况,在API level 9及其以上的系统,可直接调用File对象的相关方法,以下 ...

  4. linux系统下修改文件夹目录权限

    linux系统下修改文件夹目录权限 文件夹权限问题 Linux.Fedora.Ubuntu修改文件.文件夹权限的方法差不多.很多人开始接触Linux时都很头痛Linux的文件权限问题.这里告诉大家如何 ...

  5. .NET学习之路----我对P/Invoke技术的理解(一)

    看了P/Invoke技术的介绍,于是想写下点东西,东西包含两个部分:知识的纪录和我的理解及疑问. r托管代码中调用非托管API函数的过程 1.定位包含API的DLL: 2.载入DLL 3.找到DLL中 ...

  6. Sybase 出错解决步骤

    总结: 1.出错该错误可以先检查一下Sybase BCKServer服务有没有启动 2.在dsedit看能否ping通备份服务 3.检查master库sysservers表的配置 4.如在备份数据库d ...

  7. 2015.5.2-2015.5.8 Tip jQuery ,前端组件库,inline-block元素间距等

    有忙于它事,故延迟了,但在坚持! 1.Tip jQuery   2.给span加display: inline-block; 怎样能对齐? 解决方法:vertical-align: bottom:   ...

  8. R语言-Kindle特价书爬榜示例 & 输出HTML小技巧

    博客总目录:http://www.cnblogs.com/weibaar/p/4507801.html ---- 自从买了kindle以后,总是想要定期刷有没有便宜的书,amazon经常有些1元/2元 ...

  9. 给CentOS6.3 + PHP5.3 安装PHP性能测试工具 XHProf-0.9.2

    一.什么是XHProf XHProf官网:http://pecl.php.net/package/xhprof XHProf是一个分层PHP性能分析工具.它报告函数级别的请求次数和各种指标,包括 阻塞 ...

  10. 第2月第5天 arc invocation getReturnValue

    http://blog.csdn.net/zengconggen/article/details/38024625