Codeforces 559A(计算几何)
2 seconds
256 megabytes
standard input
standard output
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.
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.
Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.
1 1 1 1 1 1
6
1 2 1 2 1 2
13
This is what Gerald's hexagon looks like in the first sample:
And that's what it looks like in the second sample:
题意:给定一个等角的六边形,用平行与边的线将它切成三角形,问最终切成几个三角形?
做法:六边形的全部都被分为了小三角形,所以用六边形的面积/三角形的面积就是三角形的数量
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;
double a1,a2,a3,a4,a5,a6;
int main()
{
scanf("%lf%lf%lf%lf%lf%lf",&a1,&a2,&a3,&a4,&a5,&a6);
printf("%d\n",(int)((a1+a4)*(a2+a3)+a2*a3+a5*a6+0.5));
return ;
}
Codeforces 559A(计算几何)的更多相关文章
- Codeforces 559A 第六周 O题
Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angle ...
- codeforces 559A(Gerald's Hexagon)
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Gera ...
- Codeforces Gym100543B 计算几何 凸包 线段树 二分/三分 卡常
原文链接https://www.cnblogs.com/zhouzhendong/p/CF-Gym100543B.html 题目传送门 - CF-Gym100543B 题意 给定一个折线图,对于每一条 ...
- codeforces 559a//Gerald's Hexagon// Codeforces Round #313(Div. 1)
题意:面积是sqrt(3)/4的多少倍? 做延长线 #pragma comment(linker,"/STACK:1024000000,1024000000") #include& ...
- Codeforces 559A Gerald's Hexagon 数三角形
题意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形. 把单位三角形面积看做1,实际上就是求六边形面积.随便找六边形的三条互相不相邻的边,分别以这三条 ...
- Codeforces Round #335 (Div. 1) C. Freelancer's Dreams 计算几何
C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contes ...
- Codeforces 749B:Parallelogram is Back(计算几何)
http://codeforces.com/problemset/problem/749/B 题意:已知平行四边形三个顶点,求另外一个顶点可能的位置. 思路:用向量来做. #include <c ...
- Codeforces Round #339 (Div. 1) A. Peter and Snow Blower 计算几何
A. Peter and Snow Blower 题目连接: http://www.codeforces.com/contest/613/problem/A Description Peter got ...
- Codeforces Round #524 (Div. 2) C. Masha and two friends(思维+计算几何?)
传送门 https://www.cnblogs.com/violet-acmer/p/10146350.html 题意: 有一块 n*m 的棋盘,初始,黑白块相间排列,且左下角为白块. 给出两个区间[ ...
随机推荐
- 关于Java虚拟机
先占个坑,可以参考以下两篇文档来进行初步的学习 http://www.cnblogs.com/fingerboy/p/5456371.html http://www.importnew.com/244 ...
- C/C++ static
C/C++中static关键字作用总结 1.先来介绍它的第一条也是最重要的一条:隐藏.(static函数,static变量均可) 当同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全 ...
- c# 从DataGridVieew导出到excel
public static bool DataGridViewToExcel(DataGridView dataGridView, bool isShowExcel) { int rowsQty = ...
- python数据类型常用内置函数之字符串
1.strip, lstrip, rstrip x = ' jiahuifeng ' print(x.strip(' ')) print(x.lstrip(' ')) print(x.rstrip(' ...
- [ERROR ] Error parsing configuration file: /etc/salt/minion - conf should be a document, not <type 'str'>.
错误信息 [ERROR ] Error parsing configuration file: /etc/salt/minion - conf should be a document, not &l ...
- SQL比较两表字段和字段类型
一.问题 业务需要把TB_Delete_KYSubProject表数据恢复到TB_KYSubProject,但提示错误,错误原因是两表字段类型存在不一致 insert into [TB_KYSubPr ...
- WCF未找到终结点
配置都配了,仍然找不到,config文件没有重新加载,原因不详,只能重新编译一下,就好了....后续找找原因看看
- JDBC-Web项目导入mysql驱动包路径-Eclipse & Myeclipse
初学JAVA,很多都不懂,开始听老师说导入数据库驱动包的时候是: 右键项目 -> Properties -> Java Build Path -> 右侧选项卡选择Libraries ...
- MySQL教程之存储过程与函数
存储程序分为存储过程和函数 可以使用CALL来调用存储过程,只能输出变量返回值.存储过程可以调用其他存储过程 函数可以从语句外调用,也能返回标量值 什么是存储过程? 简单的说,就是一组SQL语句集,功 ...
- maven添加本地jar包到本地仓库
1 进入jar包所在文件夹,进入cmd命令 2 执行命令 mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -Dartif ...