Codeforces 560 C Gerald ' s Hexagon

Source: Internet
Author: User
Tags cos

God's precision ......... ........ It's all right, whatever it is, don't worry about it.


is to make the hexagon complete into a triangle, and then remove the complement of the three triangles, and then the area divided by the length of 1 of the Triangle area can be ....



#include <map> #include <string> #include <cstring> #include <cstdio> #include <cstdlib># include<cmath> #include <queue> #include <vector> #include <iostream> #include <algorithm > #include <bitset> #include <climits> #include <list> #include <iomanip> #include <stack > #include <set>using namespace std;const double Pi=acos ( -1.0);d ouble a[6];int Main () {for (int i=0;i<6;i++) Cin>>a[i];d ouble side=a[0]+a[1]+a[2],area=pow (side,2) *sin (PI/3) *cos (PI/3) Area-=pow (a[0],2) *sin (PI/3) *cos (PI/3) +pow (a[2],2) *sin (PI/3) *cos (PI/3) +pow (a[4],2) *sin (PI/3) *cos (PI/3);d ouble ans=area/(sin (PI/3) *cos (PI/3)); printf ("%.0f", ans);}





Time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Gerald got a very curious hexagon for his birthday. The boy found the angles of the hexagon is equal to. Then he measured the length of their sides, and found that each of the them are 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 had got. But there were so many of them, Gerald lost the track of he counting. Help the boy count the triangles.

Input

The first and the single line of the input contains 6 space-separated integers a1,? a 2,? a 3,? a 4,? a 5 and a6 (1?≤? a i? ≤?1000)-the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed, 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, to 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
Note

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

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



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Codeforces 560 C Gerald ' s Hexagon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.