Codeforces 559A Gerald's Hexagon 数三角形
题意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形。
把单位三角形面积看做1,实际上就是求六边形面积。随便找六边形的三条互相不相邻的边,分别以这三条边为基础向外扩展一个等边三角形。就可以将原六边形补成一个大等边三角形,然后用大等边三角形面积减去补上的3个小等边三角形面积就是原来六边形的面积。
而等边三角形面积非常easy。就是边长的平方(实际就是边长为n的等边三角形能分解成n^2个边长为1的单位三角形,画个图就能理解了)。
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <map>
#include <set>
using namespace std; int a, b, c, d, e, f; int main()
{
while(scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF)
printf("%d\n", (a + b + c)*(a + b + c) - (a*a + c*c + e*e));
return 0;
}
Codeforces 559A Gerald's Hexagon 数三角形的更多相关文章
- 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 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 559A(Gerald's Hexagon)
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Gera ...
- codeforces 560 C Gerald's Hexagon
神精度--------这都能过.随便算就好了,根本不用操心 就是把六边形补全成三角形.然后去掉补的三个三角形,然后面积除以边长1的三角形的面积就可以.... #include<map> # ...
- 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 ...
- Codeforces Round #313 (Div. 1) Gerald's Hexagon
http://codeforces.com/contest/559/problem/A 题目大意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形. 解 ...
- codeforces 559a//Gerald's Hexagon// Codeforces Round #313(Div. 1)
题意:面积是sqrt(3)/4的多少倍? 做延长线 #pragma comment(linker,"/STACK:1024000000,1024000000") #include& ...
- CodeForces 559C Gerald and Gia (格路+容斥+DP)
CodeForces 559C Gerald and Gia 大致题意:有一个 \(N\times M\) 的网格,其中有些格子是黑色的,现在需要求出从左上角到右下角不经过黑色格子的方案数(模 \(1 ...
随机推荐
- VMware下最小化安装centos 7 后上网设置
1.文件/etc/sysconfig/network-scripts/ifcfg-eno16777736 将ONBOOT=no 改为 ONBOOT=yes 保存 2.重启网卡:service netw ...
- Ubuntu系统下的多路径软件 DM Multipath 配置。
Ubuntu系统下的多路径软件是操作系统自带的 DM Multipath工具.------------------------------------------------------------- ...
- react-native signatures do not match the previously installed version;
原因:手机上已经安装过打包后的apk应用,与真机调试无法共存. 解决办法:删除手机上已经安装过的apk应用.
- python3 类、对象的基础概念
类:具有相同特性和方法的抽象概念称为类 对象:从类中具体描述的一个事物称为对象 类和对象的关系:类是对象的抽象概念,对象是类的具体实例 class test001: #创建类 def __init__ ...
- Tomcat 的三种高级运行模式
Tomcat 的连接器有两种:HTTP和AJP AJP(Apache JServ Protocol):AJP是面向数据包的基于TCP/IP的协议,它在Apache和Tomcat的实例之间提供了一个专用 ...
- 1.6 INSERT语句
1.6 INSERT语句正在更新内容,请稍后
- OpenCASCADE Job - 武汉中南
中南设计集团(武汉)工程技术研究院有限公司是中南工程咨询设计集团有限公司(以下简称“中南设计集团”)打造的工程技术研发和科研创新平台,为中南设计集团旗下全资子公司,于2018年2月成立.公司业务范围涵 ...
- [Servlet]研究ServletContext对象
作者信息 作者姓名:金云龙 个人站点:http://www.longestory.com 个人公众帐号:搜索"longestory"或"龙哥有话说" Servl ...
- 手动连接数据库(jdbc)
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import ...
- Es61
ECMAScript和JavaScript的关系 ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准,已经在2015年6月正式发布了.Mozilla公司将在这个标准的基础 ...