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

有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. php桥接设计模式

    <?php //桥接模式 abstract class info{ protected $send=null; public function __construct($send){ $this ...

  2. Dell服务器安装OpenManage(OMSA)

    公司上架了一批戴尔服务器,公司要求对这些服务器的硬件做一系列的监控,如CPU的温度,内存,风扇的状态,转速,磁盘等硬件的监控. 在对服务器的硬件监控上,目前业界主要基于如下两种: 1.服务器自带的工具 ...

  3. Filter体现职责链模式

    1. 前言 Filter—Filter 技术是servlet2.3 新增加的功能.完成的流程:对用户请求进行预处理,接着将请求交给Servlet进行处理并生成响应,最后Filter再对服务器响应进行后 ...

  4. Aspose.Cells 导出 excel

    Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(); Aspose.Cells.Worksheet sheet = book.Worksh ...

  5. Json.Net 数据解析

    参考资料: 随笔分类 - Json.Net系列

  6. PHP之static静态变量详解(一)

    什么是static静态变量?(以下为在C语言中的理解) 静态变量 类型说明符是static. 静态变量属于静态存储方式,其存储空间为内存中的静态数据区(在静态存储区内分配存储单元),该 区域中的数据在 ...

  7. C和指针 第十二章 结构体 整体赋值 error: expected expression

    定义结构体后整体赋值时发生错误 typedef struct NODE { struct NODE *fwd; struct NODE *bwd; int value; } Node; //声明变量 ...

  8. IDA插件栈字符串识别插件

    该插件是一款可以自动识别栈上局部变量为字符串的插件,字符串形式如下,并自动的加上注释                                       如图:可以自动识别栈上的字符串 项目主 ...

  9. ServiceStack.Redis订阅发布服务的调用

    1.Redis订阅发布介绍 Redis订阅发布是一种消息通信模式:发布者(publisher)发送消息,订阅者(Subscriber)接受消息.类似于设计模式中的观察者模式. 发布者和订阅者之间使用频 ...

  10. ubuntu 安装vsftpd服务器 ftp

    http://www.cnblogs.com/likwo/p/3154868.html http://help.aliyun.com/knowledge_detail.htm?knowledgeId= ...