题意:给定一个由很多正三角形组成的六边形的边长,求该六边形是由多少个三角形组成的
>> face <<
Strategy: ![ZgJh2n.png](https://i-blog.csdnimg.cn/blog_migrate/e79e4adbf10602f47147209924884999.png)
然后仔细想想就会发现:
a n s = ( a 1 + a 2 + a 3 ) 2 − a 1 2 − a 3 2 − a 5 2 ans = (a_1 + a_2+ a_3)^2 - a_1^2 - a_3^2 - a_5^2 ans=(a1+a2+a3)2−a12−a32−a52
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define oo INT_MAX
#define ll long long
#define db double
#define all(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rev(i, a, b) for (int i = (a); i >= (b); --i)
#define x first
#define y second
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define lowbit(x) x &(-x)
#define pi acos(-1.0)
using namespace std;
using namespace __gnu_pbds;
const int maxn = 1009;
// FILE *o = freopen("C:\\Users\\Jason.Z\\Desktop\\in.txt", "r", stdin);
// assert(o != NULL);
// FILE *e = freopen("C:\\Users\\Jason.Z\\Desktop\\y[i].txt", "w", stdout);
// assert(e != NULL);
int main(){
ios::sync_with_stdio(0);
vector <ll> a(7);
_rep(i, 1, 6){
cin >> a[i];
}
cout << (a[1] + a[2] + a[3]) * (a[1] + a[2] + a[3]) - a[1] * a[1] - a[3] * a[3] - a[5] * a[5] << endl;
}