【HDU5828】Hard problem(计算几何)

来源:互联网 发布:淘宝卖家开通不了花呗 编辑:程序博客网 时间:2024/05/12 19:19

记录一个菜逼的成长。。

参考博客:http://www.cnblogs.com/inmoonlight/p/5788081.html
这里写图片描述

#include <cstdio>#include <iostream>#include <cstring>#include <string>#include <algorithm>#include <cstdlib>#include <vector>#include <set>#include <map>#include <queue>#include <stack>#include <list>#include <deque>#include <cctype>#include <bitset>#include <cmath>using namespace std;#define ALL(v) (v).begin(),(v).end()#define cl(a) memset(a,0,sizeof(a))#define bp __builtin_popcount#define pb push_back#define fin freopen("D://in.txt","r",stdin)#define fout freopen("D://out.txt","w",stdout)#define lson t<<1,l,mid#define rson t<<1|1,mid+1,r#define seglen (node[t].r-node[t].l+1)typedef long long LL;typedef unsigned long long ULL;typedef pair<int,int> PII;typedef pair<LL,LL> PLL;typedef vector<PII> VPII;const int INF = 0x3f3f3f3f;const int MOD = 1e9 + 7;template <typename T>inline void read(T &x){    T ans=0;    char last=' ',ch=getchar();    while(ch<'0' || ch>'9')last=ch,ch=getchar();    while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();    if(last=='-')ans=-ans;    x = ans;}inline bool DBread(double &num){    char in;double Dec=0.1;    bool IsN=false,IsD=false;    in=getchar();    if(in==EOF) return false;    while(in!='-'&&in!='.'&&(in<'0'||in>'9'))        in=getchar();    if(in=='-'){IsN=true;num=0;}    else if(in=='.'){IsD=true;num=0;}    else num=in-'0';    if(!IsD){        while(in=getchar(),in>='0'&&in<='9'){            num*=10;num+=in-'0';}    }    if(in!='.'){        if(IsN) num=-num;            return true;    }else{        while(in=getchar(),in>='0'&&in<='9'){                num+=Dec*(in-'0');Dec*=0.1;        }    }    if(IsN) num=-num;    return true;}template <typename T>inline void write(T a) {    if(a < 0) { putchar('-'); a = -a; }    if(a >= 10) write(a / 10);    putchar(a % 10 + '0');}/******************head***********************/int main(){    //fin;    //fout;    double tmp = 1.0 / 8 * acos(sqrt(2)/4) - 0.5 * acos(5 * sqrt(2) / 8) + sqrt(7) / 16;    tmp *= 4;    int T;read(T);    while(T--){        int l;read(l);        printf("%.2f\n",l * l * tmp);    }    return 0;}
0 0
原创粉丝点击