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 ...
随机推荐
- jQuery-3~4章
jQuery-3~5章 JQuery003-JQuery中的DOM操作 jQuery中的DOM操作: 1.查找节点 A.查找元素节点 B. 查找属性节点 var s1 = $("ul li: ...
- for循环递归树
protected string _menu = string.Empty; public void FirstAnsyData() { try { // List<object> lsN ...
- css3 动画效果 定义和绑定执行
首先要定义一个动画效果 keyframes 关键字 这里动画效果执行完毕后 恢复本身的css样式 有的动画效果 移动到位置 要保持 就需要写好css 元素的位置 css里直接写 (这里是一般的 ...
- 关于学习JavaScript 的 高三编程 一些心得(三)
最近在学习高三的 过程中,遇到的了一些 难以理解的问题, 在看到第五章之前都是 OK 的.但是到了 引用类型的时候就有点蒙了. 首先我们看下,引用类型的 解释:[引用类型的值(对象)是引用类型的一个 ...
- @SuppressWarnings注解的用法
一.前言 编码时我们总会发现如下变量未被使用的警告提示: 上述代码编译通过且可以运行,但每行前面的"感叹号"就严重阻碍了我们判断该行是否设置的断点了.这时我们可以在方法前添加 @S ...
- MySql 外键约束 之CASCADE、SET NULL、RESTRICT、NO ACTION分析和作用
MySQL有两种常用的引擎类型:MyISAM和InnoDB.目前只有InnoDB引擎类型支持外键约束.InnoDB中外键约束定义的语法如下: ALTER TABLE tbl_name ADD [CON ...
- MVVM开发模式简单实例MVVM Demo【续】
本文将接着上篇文章,介绍一下三点:(Universal App) 1.将添加Product集合,绑定到列表 2.给点击ListBox的添加选项改变时的事件(要附加依赖属性,和Button点击事件不同) ...
- U盘安装Windows 7 + Ubuntu 14 双系统笔记
第一个系统是Windows 7系统,现在采用U盘安装 Ubuntu 14,实现双系统,主要会用到3个软件: 1.DiskGenius - 磁盘修复.分区.调整分区工具,点击下载: 用这个工具先腾出一个 ...
- 数据结构快速回顾——平衡二叉树 AVL (转)
平衡二叉树(Balanced Binary Tree)是二叉查找树的一个进化体,也是第一个引入平衡概念的二叉树.1962年,G.M. Adelson-Velsky 和 E.M. Landis发明了这棵 ...
- Eclipse安装Freemarker插件
方法一:手动安装 手动安装没有成功 步骤: 1. 下载freemarker-ide : http://sourceforge.net/projects/freemarker-ide/files/ 2. ...