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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 【打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 ...

  5. 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 ...

  6. 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 ...

  7. 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的网格,让你 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. git常用命令-基本操作

    git常用命令-基本操作 1)      新增文件 新增了Test_1.java git add Test_1.java git commit –m “新增了Test_1.java” git push ...

  2. [开发笔记]-MarkDown语法

    马克飞象MarkDown在线编辑器 http://maxiang.info/?basic 1. H1--H6 相应数量的# 2. 底线形式 = H1(最高阶标题)和- H2(第二阶标题) 3. 段落和 ...

  3. Jenkins:”ResourceRules.plist: cannot read resources” error after Xcode 6.1

    在 Custom xcodebuild arguments 处填入: "CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plis ...

  4. 使用Condition实现多线程之间调用(生产消费模式)

    一,object 类的wait(),notify()和notifyAll() Java 线程类也是一个object 类,它的实例都继承自java.lang.Thread 或其子类.wait(),not ...

  5. samba 服务器的搭建

    一,安装samba4 不要直接 yum install samba ,默认安装的是samba3版本,但这个版本有问题(open_rpc_pipe_p: copy_serverinfo failed这个 ...

  6. Xcode 文档注释方法

    摘自:http://www.cnblogs.com/bomo/p/4815963.html 文档注释,可以在调用时显示注释信息,让调用者更好的理解方法的用途. 注释方法: /// 注释 和 /** 注 ...

  7. Android开发之Canvas rotate方法释疑

    Canvas的rotate()函数本应该是很简单的一个函数,但是由于api手册言之不详,使用中难免有吃不准的地方.下面所记录的几点,都是我在使用中所迷惑过的问题,特此记录. 1,坐标原点在哪里? 如果 ...

  8. [PaPaPa][需求说明书][V0.3]

    PaPaPa软件需求说明书V0.3 前   言 不好意思,本文是没有前言的. 别说是前言了,其实关于界面的内容我也是不打算写!!   因为我知道你们想要的界面是这样的: 再不济也应该是这样的: 但是我 ...

  9. asp.net MVC之 自定义过滤器(Filter)

    一.系统过滤器使用说明 1.OutputCache过滤器 OutputCache过滤器用于缓存你查询结果,这样可以提高用户体验,也可以减少查询次数.它有以下属性: Duration:缓存的时间,以秒为 ...

  10. 谈一下OOP的乱用现象

    很久很久以前写了两篇设计模式乱用的文章,最近心血来潮,突然想写篇OOP乱用. 最近在移植一个旧项目,接手过程很多嘈想吐,开一篇谈一下OOP的乱用. 大多数公司用MVC是为了解耦合,但是这套代码的MVC ...