Code Forces 559 A. Gerald's Hexagon(水~)
来源:互联网 发布:php artisan optimize 编辑:程序博客网 时间:2024/06/02 03:08
Description
现给出一个内角都为120度的六边形的六条边长度,问这个六边形包含多少边长为单位长度的小正三角形
Input
六个整数表示六边形六条边长度,按顺序输入
Output
输出小三角形个数
Sample Input
1 1 1 1 1 1
Sample Output
6
Solution
简单题,把六边形补成三角形,计算其含小三角形的个数然后减去三个角的小三角形数量即可
Code
#include<cstdio>#include<cstring>#include<iostream>using namespace std;int main(){ int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; int x=a+b+c; int ans=x*x-a*a-c*c-e*e; cout<<ans<<endl; return 0;}
0 0
- Code Forces 559 A. Gerald's Hexagon(水~)
- A. Gerald's Hexagon
- codeforces-559A-Gerald's Hexagon
- CodeForces 559A Gerald's Hexagon
- CodeForces 559A Gerald's Hexagon
- codeforces 559A Gerald's Hexagon
- codeforces 559A A. Gerald's Hexagon(几何题)
- Codeforces 559A Gerald's Hexagon 数三角形
- CF 559A(Gerald's Hexagon-几何割补法)
- E - Gerald's Hexagon
- Code Forces 560 B. Gerald is into Art(水~)
- Code Forces 586 A. Alena's Schedule(水~)
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon
- CF 560 Gerald's Hexagon
- codeforces 560C Gerald's Hexagon(找规律)
- Codeforces Round #313 C. Gerald's Hexagon(放三角形)
- Codeforces Round #313 Gerald's Hexagon (数论)
- codeforces 560C Gerald's Hexagon (数学+思维)
- JavaScript中instanceof与typeof运算符的用法及区别详细解析
- 设计模式(1):单例设计模式
- 微信学习资源
- uva120--模拟
- zoj2172
- Code Forces 559 A. Gerald's Hexagon(水~)
- 如何使用 git 忽略掉已经被 git 管理的文件
- 为什么C++基类析构函数写成虚函数
- 面试题19_二叉树的镜像——剑指offer系列
- Unity3D 学习入门
- JS获取随机颜色函数
- Switch case的应用
- 博洛尼亚中文离线地图App上线
- Sliding Window Maximum