Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学
C. Gerald's Hexagon
Time Limit: 2 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/559/problem/A
Description
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 Input
1 1 1 1 1 1
Sample Output
6
HINT
题意
给你一个角都是120度的六边形,问有多少个边长为1的正三角形
题解:
吧六边形画成大的正三角形,减下就OK了
代码
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <vector>
#include <string.h>
#define mod 1000000007
using namespace std;
//******************************* int a,b,c,d,e,f; int main(){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
int t=a+b+c;
cout<<t*t-a*a-e*e-c*c<<endl;
return ;
}
Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学的更多相关文章
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon 数学题
A. Gerald's Hexagon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/p ...
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...
- Codeforces Round #313 (Div. 2) C. Gerald's Hexagon(补大三角形)
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #313 (Div. 2) 560C Gerald's Hexagon(脑洞)
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
Gerald and Giant Chess Problem's Link: http://codeforces.com/contest/559/problem/C Mean: 一个n*m的网格,让你 ...
- Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...
- Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess DP
C. Gerald and Giant Chess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...
随机推荐
- Javascript的调试利器:Firebug使用详解
转载自:http://blog.csdn.net/tianxiaode/archive/2007/09/02/1769152.aspx 一直在用firebug,可是没有这么精通,今天看到本文章觉得 ...
- ios框架中UIResponder的职责链设计模式应用
今天有空,就把UIResponder的职责链图上传一下 如果不理解职责链设计模式的朋友,请参考:http://www.cnblogs.com/langtianya/p/4060941.html
- javascript单例模式的理解
javascript单例模式的理解 阅读目录 理解单例模式 使用代理实现单例模式 理解惰性单例 编写通用的惰性单例 单例模式使用场景 回到顶部 理解单例模式 单例模式的含义是: 保证一个类只有一个实例 ...
- upc.2219: A^X mod P(打表 && 超越快速幂(in some ways))
2219: A^X mod P Time Limit: 5 Sec Memory Limit: 128 MB Submit: 417 Solved: 68 [Submit][Status][Web ...
- Fifth scrum meeting - 2015/10/30
概述 从昨天开始,我们的开发工作终于进入了正轨,由于之前没有mooc服务器API接口,一些工作无法进行. 因为我们团队开始开发较晚,因此我们将开发阶段的截至时间定为了下周五,测试阶段则压缩为下周周六和 ...
- HDU1068 最大独立点集
Girls and Boys Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Java基础算法集50题
最近因为要准备实习,还有一个蓝桥杯的编程比赛,所以准备加强一下算法这块,然后百度了一下java基础算法,看到的都是那50套题,那就花了差不多三个晚自习的时间吧,大体看了一遍,做了其中的27道题,有一些 ...
- java中queue的使用
Queue接口与List.Set同一级别,都是继承了Collection接口.LinkedList实现了Queue接 口.Queue接口窄化了对LinkedList的方法的访问权限(即在方法中的参数类 ...
- 对 Linux 新手非常有用的 20 个命令
参考:http://www.oschina.net/translate/useful-linux-commands-for-newbies 英文原文:http://www.tecmint.com/us ...
- iOS 关于UITableView的dequeueReusableCellWithIdentifier
今天看代码的时候,突然想到了以前的一个问题. 刚学ios那会儿,常会写出以下代码 - (UITableViewCell *)tableView:(UITableView *)tableView cel ...