标签:codeforces
题意:
#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
原文地址:http://blog.csdn.net/doris1104/article/details/47013611