Codeforces 559A Gerald ' s Hexagon number triangle

Source: Internet
Author: User

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

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.