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/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的正三角形
题解:
简单分析一下,我们可以把这个三角形,扩展成一个大的正三角形,然后减去边上的小三角形就好了~
代码
#include <iostream>
#include <cstdio> 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+f;
cout<<t*t-b*b-d*d-f*f<<endl;
return ;
}
Codeforces Round #313 (Div. 1) A. 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. 2) C. Gerald's Hexagon 数学
C. Gerald's Hexagon Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/pr ...
- 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 ...
随机推荐
- 安装配置Apache
1.更新和升级系统 sudo apt-get update sudo apt-get upgrade 2.安装和配置apache 2.1.安装apache sudo apt-get install a ...
- Oracle Database 11g Express Edition 使用小结(windows)
如何启动oraclewindows系统服务中有一个服务叫:[OracleService[SID]]SID是你安装oracle xe时候的实例名,如果你没有改默认的是[XE], OracleServic ...
- Python在centos下的安装
1.wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz默认下载到主目录下 2.tar xzf Python-2.6.6.tgz 3 ...
- Python中的并发编程
简介 我们将一个正在运行的程序称为进程.每个进程都有它自己的系统状态,包含内存状态.打开文件列表.追踪指令执行情况的程序指针以及一个保存局部变量的调用栈.通常情况下,一个进程依照一个单序列控制流顺序执 ...
- ApplicationIdle
ApplicationIdle 不忙的时候调用此事件 ::Fmx::Forms::Application->OnIdle = ApplicationIdle; void __fastcall T ...
- 转】MyEclipse使用总结——MyEclipse文件查找技巧
原博文出自于:http://www.cnblogs.com/xdp-gacl/p/3781749.html 感谢! 一.查找文件 使用快捷键[ctrl+shift+R]弹出弹出文件查找框,如下图所示: ...
- <<海闻电子发票接口 ESB 封装文档>>
<<海闻电子发票接口 ESB 封装文档>> 章节目录结构: 发票验证接口 发票开具接口 ESB请求地址: 发票验证接口: http://10.15.22.120:8866/42 ...
- 关于网上流传的四个原版Windows XP_SP2全面了解
如何查看你的XP SP2是否原版?打开Windows/System32/找到EULA这个文本文档(即eula.txt):打开在最后一行:有一个EULAID:XPSP2_RM.0_PRO_RTL_CN ...
- 使用WITH AS 的ROW_NUMBER分页
WITH tempTable AS( --复杂查询语句) SELECT * FROM (select ROW_NUMBER() Over( order by xxx) as rowNum, ...
- oradmin相关用法
[转]oradmin相关用法 创建例程: -NEW -SID sid | -SRVC 服务 [-INTPWD 口令] [-MAXUSERS 数量] [-STARTMODE a|m] [-PFILE 文 ...