Codeforces Round #313 (Div. 2) C
题意:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
typedef long long ll;
const int N = 1005;
int n;
int a[10]; int main()
{
for(int i = 1; i <= 6; i++)
{
scanf("%d", &a[i]);
}
for(int i = 1; i <= 3; i++)
{
if((a[2] + a[3]) == (a[5] + a[6])) break;
else
{
int f = a[1];
for(int j = 1; j < 6; j++)
{
a[j] = a[j+1];
}
a[6] = f;
}
}
int x = min(a[2], a[6]), y = min(a[3], a[5]);
int l = abs(a[2] - a[6]);
ll sum = 0;
int cnt = a[1];
for(int i = 1; i <= x; i++)
{
sum += (ll)2 * cnt + 1; //加上上面那个等腰梯形的面积
++cnt;
}
sum += (ll) 2 * cnt * l; //加上平行四边形面积
cnt--;
for(int i = 1; i <= y; i++)
{
sum += (ll)2 * cnt + 1; //加上以下那个等腰梯形的面积
--cnt;
}
printf("%I64d\n", sum);
return 0;
}
Codeforces Round #313 (Div. 2) C的更多相关文章
- Codeforces Round #313 (Div. 1)
官方英文题解:http://codeforces.com/blog/entry/19237 Problem A: 题目大意: 给出内角和均为120°的六边形的六条边长(均为正整数),求最多能划分成多少 ...
- 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. 1) B. Equivalent Strings
Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...
- 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. 2)B.B. Gerald is into Art
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/ ...
- Codeforces Round #313 (Div. 2) D. Equivalent Strings
D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...
- 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/pr ...
- Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...
- Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess (Lucas + dp)
题目链接:http://codeforces.com/contest/560/problem/E 给你一个n*m的网格,有k个坏点,问你从(1,1)到(n,m)不经过坏点有多少条路径. 先把这些坏点排 ...
- Codeforces Round #313 (Div. 1) B. Equivalent Strings DFS暴力
B. Equivalent Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559 ...
随机推荐
- 粗略整理的java面试题
1.垃圾回收 是回收的空闲堆空间 只有在cpu空闲并且堆空间不足的情况下才回收 2.threadlocal 就是为线程的变量都提供了一个副本,每个线程运行都只是在更新这个副本. Threadloc ...
- TFS在项目中Devops落地进程(上)
经过近2年折腾,基于TFS的Devops主线工程大体落地完毕.在此大体回忆下中间的各种历程. 开始之前简单说下什么是TFS(Team Foundation Server). TFS是微软推出的一款AL ...
- 四:Java使用google的thumbnailator工具对图片压缩水印等做处理
Thumbnailator是一个非常好的图片开源工具 使用方法: 在pom中加入以下jar包 <!-- 图片缩略图 图片压缩 水印 start--> <dependency>& ...
- 【基础】Attribute的妙用
一.何为Attribute 下面是微软官方对Attribute的解释: 公共语言运行时允许你添加类似关键字的描述声明,叫做Attributes,它对程序中的元素进行标注,如类型.字段.方法和属性等.A ...
- [转载] Cassandra入门 框架模型 总结
转载自http://asyty.iteye.com/blog/1202072 一.Cassandra框架二.Cassandra数据模型 Colum / Colum Family, SuperColum ...
- VMware下Linux网络配置局域网和外网访问
要使用Linux系统很重要的一个操作就是使Linux系统能够访问互联网,只有Linux系统能够访问互联网才能够去下载很多自己所需要的资源,如果不能访问互联网那么使用Linux系统往往会卡在这一步,假设 ...
- ssh简单配置
Port 2223Protocol 2HostKey /etc/ssh/ssh_host_rsa_keyHostKey /etc/ssh/ssh_host_dsa_keyKeyRegeneration ...
- ASP.NET异常处理机制
try{ //获取并使用资源,可能出现异常}catch(DivideByZeroException de){}catch(ArithmeticException ae){}catch(Exceptio ...
- TFboy养成记 MNIST Classification (主要是如何计算accuracy)
参考:莫烦. 主要是运用的MLP.另外这里用到的是批训练: 这个代码很简单,跟上次的基本没有什么区别. 这里的lossfunction用到的是是交叉熵cross_entropy.可能网上很多形式跟这里 ...
- virtualbox下centos实现主宿互访
1.网络连接方式 NAT 桥接 Host-Only NAT: 网络地址转换,virtualbox默认采用这种连接方式,特点: 1.虚拟机配置稍作修改就能连上外网 2.虚拟机可以ping通主机,主机不能 ...