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. vue 命名视图

    命名视图 有时候想同时(同级)展示多个视图,而不是嵌套展示,例如创建一个布局,有 sidebar(侧导航) 和 main(主内容) 两个视图,这个时候命名视图就派上用场了.你可以在界面中拥有多个单独命 ...

  2. nil、Nil、NULL、NSNull的区别

    nil:指向一个对象的空指针,对objective c id 对象赋空值. Nil:指向一个类的空指针,表示对类进行赋空值. NULL:指向其他类型(如:基本类型.C类型)的空指针, 用于对非对象指针 ...

  3. Codeforces Round #342 (Div. 2)-B. War of the Corporations

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. android shortcut &livefoulder

    android shortcut(实现步骤) 1.建立activity 2.minifest 里面注册并加上intent-filter,name为:android.intent.action.CREA ...

  5. Latex环境安装

    安装latex环境 sudo apt-get install texlive-full 推荐使用texstudio编辑器,简单方便高效靠谱 sudo apt-get install texstudio ...

  6. Boost学习笔记(一) 什么是Boost

    Boost库是一个功能强大.构造精巧,跨平台.开源并且完全免费的C++程序库

  7. Cookie对象工具包,对象添加,获取,修改-亲测可用

    先来了解下Cookie 和 Session对象的概念吧. 首先,Cookie是客户端缓存技术,大小一般为4kb左右,主要存储一些比较小的信息,常用的例子有用户名和密码,且是不安全的: Session是 ...

  8. CocoaPods的安装和使用

    一. CocoaPods简介 CocoaPods是一个用来帮助我们管理第三方依赖库的工具.在开发iOS应用时,会经常使用第三方类库,比如SDWebImage.AFNetworking等等,手动的下载与 ...

  9. OSX的一些基本知识

    1, 熟悉OSX常用的热键: 花 +C 拷贝(注意,复制是在当前目录中制作一个副本,跟拷贝意义不一样) 花 +V 粘贴(如果用拖拽的方式进行复制,需要按住Option键,相当于Windows的Ctrl ...

  10. c# base和this关键字总结

    base:用于在派生类中实现对基类公有或者受保护成员的访问,但是只局限在构造函数.实例方法和实例属性访问器中.MSDN中小结的具体功能包括:    (1)调用基类上已被其他方法重写的方法.     ( ...