A. Gerald's Hexagon
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Examples
input
1 1 1 1 1 1
output
6
input
1 2 1 2 1 2
output
13
Note

This is what Gerald's hexagon looks like in the first sample:

And that's what it looks like in the second sample:

题意:给定一个等角的六边形,用平行与边的线将它切成三角形,问最终切成几个三角形?

做法:六边形的全部都被分为了小三角形,所以用六边形的面积/三角形的面积就是三角形的数量

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;
double a1,a2,a3,a4,a5,a6;
int main()
{
scanf("%lf%lf%lf%lf%lf%lf",&a1,&a2,&a3,&a4,&a5,&a6);
printf("%d\n",(int)((a1+a4)*(a2+a3)+a2*a3+a5*a6+0.5));
return ;
}

Codeforces 559A(计算几何)的更多相关文章

  1. Codeforces 559A 第六周 O题

    Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angle ...

  2. codeforces 559A(Gerald's Hexagon)

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

  3. Codeforces Gym100543B 计算几何 凸包 线段树 二分/三分 卡常

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF-Gym100543B.html 题目传送门 - CF-Gym100543B 题意 给定一个折线图,对于每一条 ...

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

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

  5. Codeforces 559A Gerald&#39;s Hexagon 数三角形

    题意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形. 把单位三角形面积看做1,实际上就是求六边形面积.随便找六边形的三条互相不相邻的边,分别以这三条 ...

  6. Codeforces Round #335 (Div. 1) C. Freelancer's Dreams 计算几何

    C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contes ...

  7. Codeforces 749B:Parallelogram is Back(计算几何)

    http://codeforces.com/problemset/problem/749/B 题意:已知平行四边形三个顶点,求另外一个顶点可能的位置. 思路:用向量来做. #include <c ...

  8. Codeforces Round #339 (Div. 1) A. Peter and Snow Blower 计算几何

    A. Peter and Snow Blower 题目连接: http://www.codeforces.com/contest/613/problem/A Description Peter got ...

  9. Codeforces Round #524 (Div. 2) C. Masha and two friends(思维+计算几何?)

    传送门 https://www.cnblogs.com/violet-acmer/p/10146350.html 题意: 有一块 n*m 的棋盘,初始,黑白块相间排列,且左下角为白块. 给出两个区间[ ...

随机推荐

  1. 版本号比较versioncompare方法,java实现

    测试

  2. 洛谷 P1361 小猫爬山

    题目描述 WD和LHX饲养了N只小猫,这天,小猫们要去爬山.经历了千辛万苦,小猫们终于爬上了山顶,但是疲倦的它们再也不想徒步走下山了. WD和LHX只好花钱让它们坐索道下山.索道上的缆车最大承重量为W ...

  3. 封装addClass 、 removeClass

    <script> window.onload = function() { var oDiv = document.getElementById('div1'); var oDiv2 = ...

  4. autoHeight.vue 高度自适应

    autoHeight.vue 高度自适应 <!-- * @description 自适应高度 * @fileName autoHeight.vue * @author 彭成刚 * @date 2 ...

  5. Convert Sorted List to Balanced Binary Search Tree leetcode

    题目:将非递减有序的链表转化为平衡二叉查找树! 参考的博客:http://blog.csdn.net/worldwindjp/article/details/39722643 利用递归思想:首先找到链 ...

  6. 关于MessageBox返回值

    风格设置MB_OK. 此时无论点击确定还是点击X,都返回IDOK.风格设置MB_OKCANCEL,点击确认返回IDOK,点击取消和X都返回IDCANCEL.风格设置MB_YESNO,点击是返回IDYE ...

  7. python常用模块之random

    random模块 import random print(random.random())#(0,1)----float 大于0且小于1之间的小数 print(random.randint(1,3)) ...

  8. 2. CHARACTER_SETS

    2. CHARACTER_SETS CHARACTER_SETS表提供有关可用字符集的信息. 下表中的SHOW Name值对应于SHOW CHARACTER SET语句的列名. INFORMATION ...

  9. 2. 更改InnoDB redo日志文件的数量或大小

    2. 更改InnoDB redo日志文件的数量或大小 要更改InnoDB 重做日志文件的数量或大小,请执行以下步骤: 1)停止MySQL服务器,确保正常关闭且没有错误发生 2) 编辑my.cnf以更改 ...

  10. 8. Truncate undo表空间

    8. Truncate undo表空间 要Truncate Undo 表空间,必须为MySQL实例配置至少两个undo表空间(两个undo表空间可确保一个undo表空间保持活动状态,另一个处于脱机状态 ...