C. Gerald's Hexagon

Time Limit: 2 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/559/problem/A

Description

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 Input

1 1 1 1 1 1

Sample Output

6

HINT

题意

给你一个角都是120度的六边形,问有多少个边长为1的正三角形

题解:

吧六边形画成大的正三角形,减下就OK了

代码

 #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <vector>
#include <string.h>
#define mod 1000000007
using namespace std;
//******************************* int a,b,c,d,e,f; int main(){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
int t=a+b+c;
cout<<t*t-a*a-e*e-c*c<<endl;
return ;
}

Codeforces Round #313 (Div. 2) C. 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. 1) A. Gerald's Hexagon 数学题

    A. Gerald's Hexagon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/p ...

  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. 【打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 ...

  5. Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon(补大三角形)

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #313 (Div. 2) 560C Gerald&#39;s Hexagon(脑洞)

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. 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的网格,让你 ...

  8. Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题

    B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...

  9. Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess DP

    C. Gerald and Giant Chess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...

随机推荐

  1. Android手机 Fildder真机抓包

    Fiddler是一个http调试代理,它能 够记录所有的你电脑和互联网之间的http通讯,Fiddler 可以也可以让你检查所有的http通讯,设置断点,以及Fiddle 所有的“进出”的数据(指co ...

  2. javafx之CSS初探

    文档:http://www.haogongju.net/art/1807238 javafx中的css元素必须有-fx-前缀. 一.介绍 java8中新增了javafx.css开放了css相关api. ...

  3. java如何去调用C++的方法详解

    这是一个调用c++ jni 的列子 首先写一个GoodLuck 类,里面包含native本地方法,这是用作C/C++实现的.也就是用C/c++实现java的native 方法.public class ...

  4. yum使用本地源

    cache: [k2e喜]: 注意它的发音: 不是: keik the attribute could not be removed from the cache. 不能从缓存删除属性. YUM对服务 ...

  5. 使用sql server2005全文检索

    SQL Server 2005的全文检索采用类似Lucece的技术, 为文本检索做index, 尤其适合大文本字段的检索, 性能比Lucece差一些. 著名的stackoverflow网站也使用过SQ ...

  6. endnote参考文献格式设置

    endnote参考文献格式调整: 在office word 2010中加载了endnote x7插件之后,使用过程中发现格式有点乱,不该斜的地方斜体显示,该加方框[]的地方却没有方框,因此从网路上找资 ...

  7. Matlab之字符串处理

    Matlab处理字符串 1.取得部分字符串 我们有一个字符串 file='20131030_113109.TemporaryAlias.Poly5'; 简单操作举例: >> a=file( ...

  8. PHP表单验证

    <!DOCTYPE html> <html> <head> <title>Test Code</title> </head> & ...

  9. mysql如何用order by 自定义排序

    mysql如何用order by 自定义排序 id name roleId aaa bbb ccc ddd eee ,MySQL可以通过field()函数自定义排序,格式:field(value,st ...

  10. Controller之间传递数据:Block传值

    http://itjoy.org/?p=420 前边我们介绍过属性传值和协议传值,这里介绍一下块传值,块类似于C中的函数指针.在Controller中传递数据非常方便,还是继续上一章的例子,将数据从S ...