标签:center std 位长 return gravity stream == targe blank
题意:
#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
标签:center std 位长 return gravity stream == targe blank
原文地址:http://www.cnblogs.com/zsychanpin/p/6816387.html