Codeforces Round #313 (Div. 2) Gerald ' s Hexagon

Source: Internet
Author: User

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

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: 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.