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

有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. JQ001-认识jQuery 和 JQ002-jQuery选择器

    JQ001-认识jQuery jQuery环境配置:将jQuery.js文件引入到html页面中即可. 代码如下: <!DOCTYPE html> <html> <hea ...

  2. (转载)Sumblime Text 2 常用插件以及安装方法

    [内容提要]使用Package Control组件在线安装更方便 安装Sublime Text 2插件的方法: 1.直接安装 安装Sublime text 2插件很方便,可以直接下载安装包解压缩到Pa ...

  3. web前端历史的总结

    1.早期的前后一体,前端和后端是一个整体. 2.早期的后端mvc概念,前端只是后端mvc里面的视图层 (laravel就是mvc) 3.ajax技术改变了一切 2004年 Gmail 2005Goog ...

  4. thinkphp语言包

    1.config.php语言包相关配置. //开启语言包 'LANG_SWITCH_ON' => true, 'LANG_AUTO_DETECT' => true, // 自动侦测语言 开 ...

  5. linux rpm安装apache php mysql

    CentOS 可以通过 yum 安装: yum -y install httpd php php-mysql  mysql-serverservice httpd status|start|stop| ...

  6. Yii2中如何将Jquery放在head中的方法

    原文地址: https://my.oschina.net/kenblog/blog/547602 方法一(推荐):针对jquery进行components配置,指定Yii2自带jquery自带资源出现 ...

  7. 每日学习笔记:js中可以直接用id名调用的问题?

    在JavaScript中,标准的id选择器调用语法是: document.getElementById('myid').style.width = pc + "%"; 但是,今天发 ...

  8. 将十六进制色值转换成Color

    在给Background赋值时,除了自带的Red,Blue,Black等,可以通过以下方法赋予其他颜色. 主要是将Hex转换成ARGB(A:alpha,表示透明度.R:Red.G:Green.B:Bl ...

  9. java 环境变量java_home配置多加了 \ 导致zookeeper莫名其妙问题。

    平时开发其实不太用得到java_home.path.classpath之类的环境变量,但是在命令行下运行java则需要用上,所以配错就可能出现莫名其妙错误. 错误JAVA_HOME 配置:D:\Pro ...

  10. int类型的正负数转换

    int aid = -this.id; 不能直接转 必须先赋值给一个变量 int c = this.id; int a = c * (-1); this.id = a;