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

Input
1 1 1 1 1 1
Output
6
Input
1 2 1 2 1 2
Output
13

Hint

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

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

题意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形。

题解:把六边形补全为一个三角行,然后求出这个三角形可以分成的边长为1的等边三角形的个数再减去刚刚补上的那部分(也就是那三个小三角形)

这里的关键就是等边三角形由小三角形组成的个数是n*n,这里的n是边长......

代码如下:

 #include <stdio.h>
int main()
{
int b1,b2,b3,b4,b5,b6;
scanf("%d%d%d%d%d%d",&b1,&b2,&b3,&b4,&b5,&b6);
int ans=(b2+b3+b4)*(b2+b3+b4)-(b2*b2+b4*b4+b6*b6);
printf("%d\n",ans);
return ;
}

Codeforces 559A 第六周 O题的更多相关文章

  1. 程序设计入门—Java语言 第六周编程题 1 单词长度(4分)

    第六周编程题 依照学术诚信条款,我保证此作业是本人独立完成的. 1 单词长度(4分) 题目内容: 你的程序要读入一行文本,其中以空格分隔为若干个单词,以'.'结束.你要输出这行文本中每个单词的长度.这 ...

  2. hdu 4548 第六周H题(美素数)

    第六周H题 - 数论,晒素数 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   De ...

  3. CodeForces 478B 第六周比赛B题

    B - B Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Descriptio ...

  4. CodeForces 569A 第六周比赛C踢

    C - C Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  5. 第六周 E题 期望.....

    Description Given a dice with n sides, you have to find the expected number of times you have to thr ...

  6. 第六周 N题

    Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (h ...

  7. HDU 1465 第六周L题

    Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了!  做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样.  ...

  8. HDU 1405 第六周 J题

    Description Tomorrow is contest day, Are you all ready?  We have been training for 45 days, and all ...

  9. HDU 2669 第六周 I题

    Description The Sky is Sprite.  The Birds is Fly in the Sky.  The Wind is Wonderful.  Blew Throw the ...

随机推荐

  1. jquery 的 ajax 在 非阻塞 时返回 XMLHttpRequest

    jquery 的 ajax 在 非阻塞 时返回 是 [object XMLHttpRequest] 对象(firefox 下 alert(对象名) 也可以直接看到对象类型) 返回的内容用 reques ...

  2. php 短信网关短信内容不能有空格

    最近在做一个短信通知功能,接口参数都按文档写好了,就是不能发送短信,查了半天,原来是短信内容有空格,之前短信用的英文标点符号,符号后都有一个空格,用了date('Y-m-d H,i,s')函数,后来把 ...

  3. Plupload文件上传组件使用API

    Plupload有以下功能和特点: 1.拥有多种上传方式:HTML5.flash.silverlight以及传统的<input type=”file” />.Plupload会自动侦测当前 ...

  4. 以NameValueCollection 修改URL中的查询参数

    以NameValueCollection 修改URL中的查询参数 本文参考于:http://www.c-sharpcorner.com/Blogs/9421/add-remove-or-modify- ...

  5. 实现 kindle 原生系统、多看系弹出注释的通用写法

    入手 Kindle 后开始自己做 ePub,之前一直用原生系统,使用的弹出注释代码如下: <p class="P_Footnote" id="ref_footnot ...

  6. 使用Boost asio实现异步的TCP/IP通信

    可以先了解一下Boost asio基本概念,以下是Boost asio实现的异步TCP/IP通信: 服务器: #include "stdafx.h" #include <io ...

  7. JS 数组乱序

    因为不想在后台操作,就使用js进行 涉及到了一个打乱数组顺序的方法 百度到的一篇 Author : Jun.lu http://www.cnblogs.com/idche/archive/2010/0 ...

  8. 说说C#和.NET的关系

    .NET和C#的关系:C#语言可以通过.NET平台编写.部署.运行.NET应用程序..NET可以支持包括C#在内的多种语言编写的应用程序..NET平台主要包括FCL(框架类库)它是微软事先定义好的类的 ...

  9. JSP之AJAX

    伴随着Web开发越来越广泛,越来越多网站开始应用AJAX.事实上,Ajax在Web应用带来的变化,我们已经在不知不觉中体验过了.例如,百度搜索提示,会员注册…… 在传统Web应用模式中,页面中用户的每 ...

  10. Python Opearte SQLAlchemy Do Something

    近段时间在看SQLAlchemy,总之万事开头难,但是么办法. Database Urls The create_engine() function produces an Engine object ...