Codeforces - Round.313.Div2.C
来源:互联网 发布:商务部 融资租赁数据 编辑:程序博客网 时间:2024/05/16 15:52
C. Gerald’s Hexagon
Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is 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 has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.
Input
The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that 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, into 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
题目给定一个六边形的六条边, 这个六边形不一定对称的.
然后用边长为1的正三角形去填满这个六边形,问要用到多少个小三角形
这个题可以直接求面积来求, 也可以直接补全一个大的正三角形….然而我当时却是shabi了, 想补全一个正的六边形去求……脑洞啊!智商啊!哪去了!被教育了!
#include <cmath>#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>#include <string>#include <map>#include <vector>#include <set>#include <queue>#include <stack>#include <iostream>#define LL long long#define pb push_back#define lb lower_bound#define eps 1e-8#define INF 0x3f3f3f3fusing namespace std;int a[10];void solve(){ for(int i=0; i<6; i++) scanf("%d", &a[i]); int ans = a[2] + a[3] + a[4]; ans *= ans; ans -= (a[0]*a[0] + a[2]*a[2] + a[4]*a[4]); printf("%d\n", ans);}int main(void){ #ifdef DK1 freopen("C:\\Users\\dell\\Desktop\\1.in","r",stdin); #endif // DK solve(); return 0;}
- Codeforces - Round.313.Div2.C
- Codeforces round 181 div2 C
- codeforces div2 round#231 C
- codeforces div2 round#230 C
- codeforces Round #352 div2 C
- Codeforces Round #409 div2 C
- Codeforces round#429 div2 C
- Codeforces Round #429 (Div2) C
- codeforces Round #237(div2) C解题报告
- codeforces Round #241(div2) C解题报告
- codeforces round #257 div2 C、D
- Codeforces Round #262(div2) C. Present
- codeforces Round #269(div2) C解题报告
- codeforces Round #267(div2) C解题报告
- codeforces Round #271(div2) C解题报告
- codeforces Round #272(div2) C解题报告
- codeforces Round #264(div2) C解题报告
- codeforces Round #263(div2) C解题报告
- 夜间肌肤护肤要做到6点 轻松摆脱各种肌肤问题
- [java]深入理解JVM内存模型
- 【Struts2框架】第二节Result-Global_Results_全局结果集
- 详解jar命令打包生成双击即可运行的Java程序
- [Leetcode 239, Hard] Sliding Window Maximum
- Codeforces - Round.313.Div2.C
- Reverse Linked List II
- 一个简单的人脸检测
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
- 2015年7月23日20:22:09
- 数据库分组函数
- perl中默认的变量介绍
- MyBatis第一天
- 十分钟搞定pandas