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/problem/A
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
Sample Output
6
HINT
题意
给你一个角都是120度的六边形,问有多少个边长为1的正三角形
题解:
吧六边形画成大的正三角形,减下就OK了
代码
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <vector>
#include <string.h>
#define mod 1000000007
using namespace std;
//******************************* int a,b,c,d,e,f; int main(){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
int t=a+b+c;
cout<<t*t-a*a-e*e-c*c<<endl;
return ;
}
Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学的更多相关文章
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
Gerald's Hexagon Problem's Link: http://codeforces.com/contest/559/problem/A Mean: 按顺时针顺序给出一个六边形的各边长 ...
- 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 ...
随机推荐
- Windows 下安装项目管理工具 Redmine 1.1.2
1.InstantRails-2.0-win 下载地址 https://rubyforge.org/frs/?group_id=904 2.redmine1.1.2 下载地址 http://www ...
- 快速搭建ssh(最终版)
一个月又忘了.还是做个笔记.自己看下就能想起来... 1.在MyEclipse中新建web Project 2.首先整合struts
- U盘10分钟安装linux系统
说来可能不信,10分钟包括创建U盘启动盘,用U盘启动,安装,不联网,不更新,不安装语言包,等装好系统再更新. Windows系统硬盘分区 如果你用的是Windows系统,现有的硬盘没有未分配的空间,需 ...
- IE浏览器模式设置
文件兼容性用于定义让IE如何编译你的网页.此文件解释文件兼容性,如何指定你网站的文件兼容性模式以及如何判断一个网页该使用的文件模式. 前言 为了帮助确保你的网页在所有未来的IE版本都有一致的外观,IE ...
- WSP (无线会话协议)
WSP (无线会话协议) WSP是在无线应用协议(WAP:Wireless Application Protocol )组中的协议,用两种服务提供无线应用环境一个稳定的接口. 中文名 WSP WAP ...
- mySQL笔记2
php主要实现B/S .net IIS java TomCat LAMP: Linux 系统 A阿帕奇服务器 Mysql数据库 Php语言(KE) mysql:c常用代码 create table c ...
- iPod怎么下载歌曲?用iTunes传文件功能!
昨儿一小美女拿我的手机听歌,说她不知道iPod怎么下载歌曲,因为还在上学家里不肯给买智能机,怕会影响学业.她的iPod shuffle刚买没多久还不会往里传歌曲,让我帮看看怎么整,心想她应该是没装iT ...
- 深入理解Java中的继承
对于面向对象的程序设计而言,每一个程序员都应该去了解Java中的封装,继承和多态,那么我今天来说的主要是以继承为核心的主题. 一.关于对继承的理解. 继承是面向对象的三大特性之一,是java中实现代码 ...
- 在CentOS 7 上搭建LAMP
导读 要求:httpd的动态和静态资源分为两台主机提供,mysql也用单独一台主机.httpd服务提供虚拟主机,一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress.安装 ...
- MySQL sql语句总结
1.说明:创建数据库CREATE DATABASE database-name2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备份数据的 d ...