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 ...
随机推荐
- Android ProgressBar分析及自定义ProgressBar
ProgressBar是在执行耗时操作时的一种人性化设计.分为两种形式:转圈的,能显示进度的. 而能取决于是什么样式的PregressBar,当然就是PregressBar的样式啦~ Widget.P ...
- 测试机安装fd-server问题记录
今天在239测试机上安装了fd-server来代替apache,汇总下遇到的问题和解决方法. 1. 安装git时使用yum安装,命令 yum install git 2. 启动fd-server之前要 ...
- 定时备份SQL SERVER的数据库并且把备份文件复制到另外一台服务器
需求介绍:每天备份线上正式库并且把备份文件复制到测试服务器,测试服务器自动把数据库备份文件还原. 方案介绍: 第1步:在正式库上创建存储过程用来备份数据库和复制到测试服务器,然后新建作业每天定时执行创 ...
- Android study --- 广播
广播接收者 在Android系统运行时会产生很多事件,事件产生时,回想系统发送广播,只要向系统发送广播,系统就知道发生了相应的事件,从而执行相对应的代码.在系统中只要使用广播接受者,就可以接收广播 创 ...
- docker里重装mysql
1.查看ubuntu下装了什么软件: dpkg -l 2.删除mariadb: apt-get autoremove --purge mariadb-server-10.0 apt-get remov ...
- ImageList图标左边有黑色竖线
ImageList图标左边有黑色竖线, 原因 ImageList颜色深度太小引起的,解决方案,把颜色深度调成Depth32Bit 默认: 修改为: 结果: 备注:根据文件获得文件的系统图标: Icon ...
- oracle,mysql,SqlServer三种数据库的分页查询的实例。
MySql: MySQL数据库实现分页比较简单,提供了 LIMIT函数.一般只需要直接写到sql语句后面就行了.LIMIT子 句可以用来限制由SELECT语句返回过来的数据数量,它有一个或两个参数,如 ...
- ES6 Map/WeakMap
最近项目用ES6来写,许多语法都要逐步熟悉呀,今天收藏下Map用法 1.Map构造器 // 字符串作为key, 和JS对象类似 var map = new Map() // set map.set(' ...
- iOS - AppStores App 上架
前言 1.准备 开发者账号 完工的项目 2.上架步骤 1) 创建 App ID 2) 创建证书请求文件(CSR文件) 3) 创建发布证书(CER) 4) 创建 Provisioning Profile ...
- 基础笔记12(socket,url网络通信)
进一步深入socket 1.网络通信条件: .IP地址,可用主机名. .传输数据时将不用的应用程序通过数字标识区分开来,这种标识称为逻辑端口,也称端口.(0-65535端口,一般系统预留0-1024) ...