CF 559A(Gerald's Hexagon-几何割补法)
我的做法是算出面积求
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])
#define Lson (x<<1)
#define Rson ((x<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
typedef long long ll;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
double a[7],x[7],y[7];
double theta=3.1415926/3;
void rotate(double &x,double &y)
{
double x2=cos(theta)*x+sin(theta)*y;
double y2=-sin(theta)*x+cos(theta)*y;
x=x2;y=y2;
}
int n=6;
int main()
{
// freopen("A.in","r",stdin);
// freopen(".out","w",stdout);
while(1)
{
For(i,n) cin>>a[i];
x[0]=y[0]=0;
double dx=1,dy=0;
For(i,n)
{
x[i]=x[i-1]+dx*a[i];
y[i]=y[i-1]+dy*a[i];
rotate(dx,dy);
}
double S=0,S1=sqrt(3)/4.0;
Rep(i,n)
{
S+=x[i]*y[i+1]-x[i+1]*y[i];
}
cout<<(int)(-S/S1/2)<<endl;
// For(i,n)
// printf("%lf %lf\n",x[i],y[i]);
break;
}
return 0;
}
然而std是...

. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.
