Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
Gerald's Hexagon
Problem's Link: http://codeforces.com/contest/559/problem/A
Mean:
按顺时针顺序给出一个六边形的各边长(且保证每个内角都是120度),求能够分解成多少个边长为1的小正三角形。
analyse:
由于每个内角都是120度,那么把三条边延长相交,一定能够得到一个正三角形。
求出正三角形的面积S1和补上的小三角形的面积S2,则answer=S1-S2.
这里不是真正意义上求正三角形的面积,而是直接求内部可以包含多少个边长为1的小正三角形。
设正三角形边长为L,则内部可包含L*L个边长为1的小正三角形。
[以下图片为外链引用,并无实意,请忽略]

Time complexity: O(1)
Source code:
}
Codeforces Round #313 (Div. 1) A. Gerald's Hexagon的更多相关文章
- 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. 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 ...
随机推荐
- JAVA自动化测试中多数据源的切换
在做自动化测试时,数据驱动是一个很重要的概念,当数据与脚本分离后,面对茫茫多的数据,管理数据又成了一个大问题,而数据源又可能面对多个,就跟在开发过程中,有时候要连接MYSQL,有时候又要连接SQL S ...
- ThinkCMF 解决xss攻击问题
最近使用ThinkCMF给某政府开发的一个平台,因为他们需要通过国家二级信息安全等级测试 所以自己先使用Appscan测试了一下,结果扫描出一个xss安全问题 测试的网址:http://www.xxx ...
- SDN论坛看到BW的问题及相关解答
SDN论坛看到BW的问题及相关解答 链接: http://blog.sina.com.cn/s/blog_5c58e3c70100r1ou.html 现在有一个 QUERY 运行十分慢 , 所以我想在 ...
- 使用shiro的SimpleHash来生成常用的摘要串
<dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</ ...
- RabbitMQ学习笔记3-使用topic交换器
topic的路由规则里使用[.]号分隔单词,使用[*]号匹配1个单词,使用[#]匹配多个.和多个*. 在下面的例子中: logger.*可以匹配logger.error和logger.warning, ...
- httpwebrequest 服务器提交了协议冲突. section=responsestatusline
调用接口的时候,包: httpwebrequest 服务器提交了协议冲突. section=responsestatusline 解决方案: req.KeepAlive = false; req.Al ...
- volley中网络请求
首先使用Volley类创建 RequestQueue queue = Volley.newRequestQueue(this); Making GET Requests final String u ...
- JS/React 判断对象是否为空对象
JS一般判断对象是否为空,我们可以采用: if(!x)的方式直接判断,但是如果是一个空对象,比如空的JSON对象,是这样的:{},简单的判断是不成功的,因为它已经占用着内存了,如果是JQuery的话, ...
- CSS基础(六):浮动深入
参考了<CSS彻底设计研究>的文章,说的很不错,所以拿来做笔记. 浮动 在标准流中,一个块级元素在水平方向会自动伸展,直到包含它的元素边界:而在竖直方向和兄弟元素依次排列,不能并排.使用浮 ...
- JAVA中关于数组的定义
前些日子,有网友问:在JAVA中 int[] a 这样定义的数组和 int a[] 定义的数组有什么区别? 当时没有细看,直接回复说,在JAVA中,两者是一样的,没有区别. 回头仔细看时,还是稍有区别 ...