Gerald's Hexagon
Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.
He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.
The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.
Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.
1 1 1 1 1 1
6
1 2 1 2 1 2
13 地址:http://codeforces.com/contest/560/problem/C 思路:额,这道题想了挺久,刚开始,想画图找规律,分层次找了半天,得出一些特殊情况的规律,但是没有什么卵用。 然后想到了面积,想到的有点迟,然后就敲代码了。结果对6边形的理解有错误,最后错了,于是乎,百度了。 数学太差没办法。。感觉上有两种做法: 1: 通过面积求 直接求面积:http://blog.csdn.net/winddreams/article/details/47016541 间接求面积:http://blog.csdn.net/crescent__moon/article/details/47017283我的代码是直接求面积
#include <cstdio> using namespace std; int main(){ ]; ; int h_area; int cnt; ]) != EOF){ ; i < ; i ++){ scanf("%d", &edge[i]); } h_area = (edge[] + edge[]) * (edge[] + edge[]) + edge[] * edge[] + edge[] * edge[]; cnt = h_area / t_area; printf("%d\n", cnt); } ; }
第2种应该就是找规律了: 时间比较晚了第2天再想想 然后再补。 2015-07-27 23:47:39
Gerald's Hexagon的更多相关文章
- 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) 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) C. Gerald's Hexagon
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon 数学题
A. Gerald's Hexagon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/p ...
- codeforces 559A(Gerald's Hexagon)
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Gera ...
- 【41.43%】【codeforces 560C】Gerald's Hexagon
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- codeforces 559a//Gerald's Hexagon// Codeforces Round #313(Div. 1)
题意:面积是sqrt(3)/4的多少倍? 做延长线 #pragma comment(linker,"/STACK:1024000000,1024000000") #include& ...
- Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings
A题,超级大水题,根据有没有1输出-1和1就行了.我沙茶,把%d写成了%n. B题,也水,两个矩形的长和宽分别加一下,剩下的两个取大的那个,看看是否框得下. C题,其实也很简单,题目保证了小三角形是正 ...
- 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...
随机推荐
- cmake 出现问题
问题: CMake Error at CMakeLists.txt:3 (find_package): By not providing "FindOpenCV.cmake" in ...
- linux常用的命令
Linux简介及Ubuntu安装 Linux,免费开源,多用户多任务系统.基于Linux有多个版本的衍生.RedHat.Ubuntu.Debian 安装VMware或VirtualBox虚拟机.具体安 ...
- ML-线性回归
记样本数目为$m$,样本点$i$用$(x^{(i)}, y^{(i)})$表示,其中 $x^{(i)}=\begin{pmatrix}x_1^{(i)}\\ x_2^{(i)}\\ ...\\x_n^ ...
- 菜鸟学Android编程——简单计算器《一》
菜鸟瞎搞,高手莫进 本人菜鸟一枚,最近在学Android编程,网上看了一些视频教程,于是想着平时手机上的计算器应该很简单,自己何不尝试着做一个呢? 于是就冒冒失失的开撸了. 简单计算器嘛,功能当然很少 ...
- Java类的加载
1.类的加载步骤 当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过加载.连接.初始化三步来实现对这个类的初始化 加载:将class文件读入内存,并为之创建一个Class对象,任何类被使用 ...
- 关于DSP的boot mode / boot loader /上电顺序 /在线升级等问题的总结
使用器件 ti dsp c2000 2837x 1.dsp的上电过程和boot mode以及boot loader 1)dsp的上电顺序, 对于双核系统而言 , 他的上电启动顺序如下所示: 系统复位或 ...
- HTML5滑动(swipe)事件
移动H5开发中经常用到滑动效果(页面上移.下移.向左滑动.向右滑动等),浏览器并没有内置swipe事件,可以通过touch事件(touchstart.touchmove和touchend)模拟swip ...
- jdbc.properties各种数据库连接配置
# HSQLDB #jdbc.driverClassName=org.hsqldb.jdbcDriver #jdbc.url=jdbc:hsqldb:hsql://localhost:9001/bo ...
- caffe python 接口设置
安装编译完成后, 运行 cd sudogedit ~/.bashrc 在打开的文件末尾加入 export PYTHONPATH=/home/caffe-master/python:$PYTHONPA ...
- Hibernate学习笔记(一)
2016/4/18 19:58:58 Hibernate学习笔记(一) 1.Hibernate框架的概述: 就是一个持久层的ORM框架. ORM:对象关系映射.将Java中实体对象与关系型数据库中表建 ...