Test instructions: In order to give a hexagon of each internal angle is 120° six edge length, the hexagon can be decomposed into how many side length of 1 units of the triangle.
The Unit Triangle area is regarded as 1, in fact, the hexagonal area is asked. Randomly looking for the hexagon of the three edges, respectively, with the three edge for the basis of the expansion of a equilateral triangle, can be the original hexagon into a large equilateral triangle, and then the large equilateral triangle area minus 3 small equilateral triangle area is the original hexagon area. and the equilateral triangle area is very simple. is the side length of the square (the actual is the side length of n equilateral triangle can be decomposed into a n^2 edge length of 1 units of the triangle, draw a picture can understand).
#include <cstdio> #include <iostream> #include <cstring> #include <string> #include <cmath > #include <algorithm> #include <stack> #include <vector> #include <map> #include <set> Using namespace Std;int A, B, C, D, E, F;int main () {while (scanf ("%d%d%d%d%d%d", &a, &b, &c, &d, & E, &f)! = EOF) printf ("%d\n", (A + B + c) * (A + B + C)-(a*a + c*c + e*e)); return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Codeforces 559A Gerald ' s Hexagon number triangle