Give the length of a hexagon six (each corner of the hexagon is 120 degrees), and find out how many of the equilateral triangle in this hexagon have a 1 edge length.
Since each corner is 120 degrees and the upper and lower sides are parallel, we can make up a rectangle and subtract the area of the surrounding four corners, dividing the area of each small triangle with the remaining area.
#include <cstdio>using namespace std;double a,b,c,d,e,f;int main () {<span style= "White-space:pre" ></ SPAN>SCANF ("%lf%lf%lf%lf%lf%lf", &a,&b,&c,&d,&e,&f); <span style= "White-space:pre" ></span>double res = (b+c) * (2*a+f+b)-F*F/2-B*B/2-E*E/2-C*c/2;<span style= "White-space:pre" ></spa n>printf ("%d\n", (int) res);
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Codeforces Round #313 (Div. 2) Gerald ' s Hexagon