集训第六周 O题
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
6
1 2 1 2 1 2
13
Hint
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"
using namespace std;
int main()
{
int a1,a2,a3,a4,a5,a6;
cin>>a1>>a2>>a3>>a4>>a5>>a6;
int l=a1+a2+a3;
cout<<l*l-a1*a1-a3*a3-a5*a5<<endl;
return ;
}
集训第六周 O题的更多相关文章
- 集训第六周 M题
Description During the early stages of the Manhattan Project, the dangers of the new radioctive ma ...
- 集训第六周 E题
E - 期望(经典问题) Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit S ...
- 程序设计入门—Java语言 第六周编程题 1 单词长度(4分)
第六周编程题 依照学术诚信条款,我保证此作业是本人独立完成的. 1 单词长度(4分) 题目内容: 你的程序要读入一行文本,其中以空格分隔为若干个单词,以'.'结束.你要输出这行文本中每个单词的长度.这 ...
- hdu 4548 第六周H题(美素数)
第六周H题 - 数论,晒素数 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u De ...
- 集训第六周 古典概型 期望 D题 Discovering Gold 期望
Description You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell o ...
- 集训第六周 矩阵快速幂 K题
Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. F ...
- 集训第六周 数学概念与方法 计数 排列 L题
Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样. 话 ...
- 集训第六周 数学概念与方法 J题 数论,质因数分解
Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all g ...
- 集训第六周 数学概念与方法 数论 线性方程 I题
Description The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Tr ...
随机推荐
- 微信支付接口调用问题(android正常,iphone调不起)
转自:http://blog.csdn.net/tt123123/article/details/53897035 碰到的问题 :根据微信提供的示例代码(ASP.NET),配置好一切后, 用andro ...
- Luogu P1970 花匠 【线性Dp】 By cellur925
题目描述 Description 花匠栋栋种了一排花,每株花都有自己的高度.花儿越长越大,也越来越挤.栋栋决定把这排中的一部分花移走,将剩下的留在原地,使得剩下的花能有空间长大,同时,栋栋希望剩下的花 ...
- solr的安装配置与helloworld
一.安装solr 1.安装jdk环境和tomcat 2.解压solr压缩包,这里我解压到opt目录下 3.把/usr/local/solr-4.8.0/dist/solr-4.8.0.war部署到to ...
- _bzoj2005 [Noi2010]能量采集
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2005 令F(i)表示i | gcd(x, y)的对数,f(i)表示gcd(x, y) = i ...
- Windows7运行无法记录历史命令问题解决
Windows7运行无法记录历史命令,每次都需要手动敲命令,解决方法如下: 1.任务栏中右键,选择"属性"菜单: 2.在弹出框中的"[开始]菜单"选项卡的隐私区 ...
- break跳出嵌套循环体
package com.wh.Object; public class Test { public static void main(String[] args) { // TODO Auto-gen ...
- java数组实现买彩票(二个一维数组的比较思想)
/** 设计一个程序,模拟从彩球池里随机抽取5个彩球(彩球池里一共有11个彩球,编号为1~11), 要求在控制台打印出这5个被取出来的彩球的编号(注意编号不能重复). 思路: 1.创建一个int类型的 ...
- ABP教程(一)- ABP介绍
ABP是什么 ABP是”ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ASP.NET Boilerplate是一个用最佳实践和流行技术开发现代WEB应用 ...
- AJPFX:如何保证对象唯一性呢?
思想: 1,不让其他程序创建该类对象. 2,在本类中创建一个本类对象. 3,对外提供方法,让其他程序获取这个对象. 步骤: 1,因为创建对象都需要构造函数初始化,只要将本类中的构造函数私有化,其他程序 ...
- turn协议的工作原理
Allocate请求 客户端通过发送Allocate请求给STUN服务器,从而让STUN服务器为A用户开启一个relay端口. a) 客户端A向STUN Port发送Allocate请求(图中 ...