# Air【省选模拟赛】

## 立体几何中的贪心

Posted by yjjr's blog on March 11, 2018 1 minutes to read

# code

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
#define lson (x<<1)
#define rson (x<<1|1)
#define mid ((l+r)>>1)
#define pi acos(-1)
#define mp make_pair
#define pb push_back
#define pa pair<int,int>
#define fi first
#define se second
#define lowbit(x) ((x)&(-x))
using namespace std;
ll f=1,x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline ll getgcd(ll x,ll y){return !x?y:getgcd(y%x,x);}
inline ll getlcm(ll x,ll y){return x/getgcd(x,y)*y;}
inline ll qpow(int x,int y,int p){
ll re=1;
while(y){
if(y&1)re=(re*x)%p;
y>>=1,x=(x*x)%p;
}
return re;
}
const int maxn=1e4+6;
struct point{double x,y;}p[maxn];
inline point operator + (point a,point b){return (point){a.x+b.x,a.y+b.y};}
inline point operator - (point a,point b){return (point){a.x-b.x,a.y-b.y};}
inline double operator * (point a,point b){return a.x*b.y-a.y*b.x;}
inline bool cmp(point a,point b){return atan2l(a.y,a.x)<atan2l(b.y,b.x);}
double val[maxn],h[maxn],ans;
int n,T;
int main()
{
while(T--){
rep(i,1,n){
p[i].x=(double)X,p[i].y=(double)Y;
}
sort(p+1,p+1+n,cmp);
p[++n]=p[1];p[0]=p[n-1];
rep(i,1,n-1)val[0]+=p[i]*p[i+1]/6;
rep(i,1,n-1)val[i]=(p[i-1]*p[i]+p[i]*p[i+1])/6;