CodeForces Round#313
第一题想当然了,结果被坑。。
有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的更多相关文章
- 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 ...
- 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 ...
- 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)不经过坏点有多少条路径. 先把这些坏点排 ...
- 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 ...
随机推荐
- ng-switch
<p>ng-switch : </p> <div ng-switch="isShow"><!--isShow是boolean值--> ...
- ecshop后台 计划任务
计划任务定时清理掉设置后的内容 主要针对单表删除(日志,):对于多表删除,不太好用(订单+订单商品+订单日志) 结构: 1.计划任务语言包:languages\zh_cn\cron\ 2.php文件: ...
- Redis学习笔记7--Redis管道(pipeline)
redis是一个cs模式的tcp server,使用和http类似的请求响应协议.一个client可以通过一个socket连接发起多个请求命令.每个请求命令发出后client通常会阻塞并等待redis ...
- 表单提交按钮input和button、a的差异
现在普遍的在网页中,表单提交数据的按钮最常见实用有三种,一种是input,一种是button,最后一种,是其他如a标签,div标签,span标签代替而来.在以前的日子里,大家都习惯于用input,因为 ...
- WP8.1 RT 生命周期详解
应用状态关系转换图 根据此“应用状态关系转换图”.有以下: 三个状态: NotRunning:未运行 Running:运行中 Suspended:挂起 三个事件: A ...
- springmvc js/css路径问题
①No mapping found for HTTP request with URI[/msm2/css/login2.css] in DispatcherServlet with name 'sp ...
- Git 常用命令合集
$ git init 建立git仓库(一般都是在github上新建好,直接克隆到本地) $ git clone **.git 克隆git仓库 $ git add -A ...
- java高cup占用解决方案
项目中发现java cpu占用高达百分之四百,查看代码发现有一个线程在空转,拉高了cup while(true){ } 解决方案,循环中加入延迟:Thread.sleep(Time): 总结下排查CP ...
- NVelocity介绍,NVelocity中文手册文档及实例下载
NVelocity是什么velocity英音:[vi'lɔsiti]美音:[və'lɑsətɪ]近在做一个项目,客户要求有网站模板功能,能够自主编辑网站的风格,因为这个系统是为政府部门做子站系统,举个 ...
- espcms列表页ajax无限加载
类似百度图片的效果,滚动到底部后,点击加载更多,加载出第二页,第三页... 替代了传统的上一页,下一页,第几页,以达到在某些情况下使得用户体验更好. 二次开发方法: 1.先在模板文件中增加ajax文件 ...