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. rabbitmq的知识点

    rabbitmq,分为集群和主从2种. 主从式与集群式的速度差10倍. 每个rabittmq组需要3台机器. 集群式,稳定性高,主从式,速度快. 可以做任务分配,单点锁(二进制树实现). 只有当消息和 ...

  2. 数据源引用 java:/comp/env

      编辑 删除 数据源引用 java:/comp/env 2012-01-28 15:59   ENC的概念: The application component environment is ref ...

  3. UVA 1479 Graph and Queries (Treap)

    题意: 给一个无向图,再给一系列操作(以下3种),输出最后的平均查询结果. (1)D X 删除第x条边. (2)Q X k  查询与点X相连的连通分量中第k大的点的权值. (3)C X v  将点X的 ...

  4. SAP CRM调查问卷的评分和图表显示功能介绍

    SAP CRM里我们使用事务码CRM_SURVEY_SUITE创建一个调查问卷(Survey): 其中调查问卷的问题和答案均可分配权值(Rate),最后该问卷总的分数等于每个问题的权值乘以客户选择答案 ...

  5. ldap_modify: No such object (32) matched DN: cn=config

    centos 6.9 部署 kerbors ldap 报错 [root@hadoop data]# ldapmodify -Y EXTERNAL -H ldapi:/// -f chdomain.ld ...

  6. Pygame - Python游戏编程入门

    >>> import pygame>>> print(pygame.ver)1.9.2a0 如果没有报错,应该是安装好了~ 如果报错找不到模块,很可能是安装版本的问 ...

  7. Python 循环结构语句

    1.for循环:计次循环 2.while循环:条件循环 3.嵌套循环 4.跳转语句 一.for循环的使用 1.进行数值循环 利用数值循环输出三次‘你好’: >>> for i in ...

  8. c语言 错误记录

    1.预处理错误 #include <>   //系统内部的 #include ""   // 自定义的 遇到 not find------解决方案:gcc -I 跟查找 ...

  9. PHP08 数组和数据结构

    学习要点 数组的分类 数组的定义 数组的遍历 预定义数组 数组的相关处理函数 PHP操作数组需要注意的细节 数组的分类 关于PHP数组 由于PHP是弱类型的编程语言,所以PHP数组中的数组变量可以存储 ...

  10. OpenCV2:第八章 视频操作

    一.简介 OpenCV提供了专门操作视频的接口类VideoCapture类,可以从文件或摄像设备中读取视频