比赛 防止浮躁的小练习v0.6 评测结果 A
题目名称 蛤玮的魔法 最终得分 100
用户昵称 Lethur 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2016-10-20 17:24:57
显示代码纯文本
#include<cmath> 
#include<cstdio>
#include<cstdlib>
#include<iostream>  
#include<algorithm>  
#define PI acos(-1.0)  
using namespace std;  
int main()  
{  
	freopen("HWmahoushaojiu.in","r",stdin);
	freopen("HWmahoushaojiu.out","w",stdout);
    int t;  
    double n,a,l,l1,x1,x2,x3,x4,s1,a1,s;  
    scanf("%d",&t);  
    while(t--)  
    {  
        scanf("%lf%lf%lf",&n,&a,&l);  
        x1=(PI/n)*2;  
        x2=(PI-x1)/2;  
        x3=x2*2;  
        x4=(PI-x3)/2;  
        l1=a*sin(x2)/sin(x1);  
        s=0.5*sin(x1)*l1*l1*n;  
        int cnt=0;  
        while(s-l>1e-6)  
        {  
            a1=a/2;  
            s1=0.5*a1*a1*sin(x3);  
            s=s-s1*n;  
            a=a1*sin(x3)/sin(x4);  
            cnt++;  
        }  
        printf("%d\n",cnt);  
    }  
    fclose(stdin);
    fclose(stdout);
    return 0;  
}