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.

Input

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.

Output

Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.

Sample test(s)
input
1 1 1 1 1 1
output
6
input
1 2 1 2 1 2
output
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的更多相关文章

  1. Codeforces Round #313 (Div. 1) A. Gerald's Hexagon

    Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. codeforces 559A(Gerald's Hexagon)

    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Description Gera ...

  6. 【41.43%】【codeforces 560C】Gerald's Hexagon

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. codeforces 559a//Gerald's Hexagon// Codeforces Round #313(Div. 1)

    题意:面积是sqrt(3)/4的多少倍? 做延长线 #pragma comment(linker,"/STACK:1024000000,1024000000") #include& ...

  8. 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题,其实也很简单,题目保证了小三角形是正 ...

  9. 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...

随机推荐

  1. 自发行python版本制作(一)

    最近使用python开发一些小玩意,发现python实在很符合我的理念:轻量级,功能强大,开放. python是一种脚本语言,不像java那样需要沉重的编译过程.这使得python更显得轻巧灵便,可以 ...

  2. Netsuite > Employee Record Name维护规则

    Employee Record Name 维护规则 - 在NS系统设计中,默认的Field展现是:First Name, Middle Name, Last Name - 在General Prefe ...

  3. linux下给网卡加VLAN标签和私网地址

    1.加载8021q协议 moprobe 8021q 2.安装必要的包 yum -y groupinstall base linux 3.添加私网地址(写到开机启动项) vconfig add bond ...

  4. OpenCV绘图

    OpenCV绘图 rectangle(Mat& img,Point pt1, Point pt2, const Scalar&color, int thickness=1,int li ...

  5. eclipse添加easyExport插件,打开本地文件

    下载地址:https://github.com/samsonw/OpenExplorer/downloads 官方:http://sourceforge.net/projects/easystruts ...

  6. REVERSE

    REVERSE函数,刚刚接触,这是一个Oracle和MS Sql都能用的,不知道是不是T-SQL标准的函数,反正能用,挺好 SELECT REVERSE('abcd') 结果为dcba,就是把字符串反 ...

  7. JAVA程序操作hbase的Maven配置pom.xml文件

    由于工作需要,用到Java连接Hbase读写数据.原来的方式是直接将依赖的jar包全部下载下来,然后工程里面引用. 现想重构下,改为使用Maven管理,遇到了各种坑,各种不好使,特总结下. <d ...

  8. 基于东北F4的设计模式情景剧——第一幕 装饰模式(Decorator Pattern)

    第一场 难题未解 布景:铁岭,晴天,午后,风.在一幢还算气派的写字楼的三层外墙上,挂着一条红色横幅,上面用歪歪扭扭的毛笔字写着"东北F4软件外包工作室".大风中,那早已褪色的条幅剧 ...

  9. <转>好婚姻是彼此放心

    -01- 临下班,马丽听到隔壁桌的方雅在打电话,声音听起来嗲声嗲气:“有个朋友晚上约我吃饭,要晚点回来,你不用等我了哦.” 电话挂断时,已经到了下班的点.方雅扭头对马丽说:“丽姐,待会我们一起去吃个饭 ...

  10. Vi指令,随时追加

    1.设置tab键的空格数 :set tabstop=4 2.显示行号 :set nu