利用余弦定理把大角度算出来,然后由已知的D,求出小三角形的底,,,结果算出来有可能是负数,要取个0,太坑了,
#include<iostream>
#include<cstdio>
#include<string>
#include<string.h>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<iomanip>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const double Pi = acos(-1.0);
const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const int MAXN = 10000;
int main()
{
double bian,kuan,d,x,y,jiao;
while(cin>>bian>>kuan>>x>>y>>d>>jiao)
{
// double a1,a2,a3;
// a3=bian*2.0;
// double jud=fabs(x)-bian;
// if(fabs(x)-bian<=eps)
// {
// a1=fabs(y);
// }
// else
// {
// double tmp1,tmp2;
// tmp1=fabs(y);
// if(jud<=eps)
// {
// tmp2=fabs(bian-fabs(x));
// }
// else
// tmp2=fabs(fabs(x)-bian);
//
// a1=sqrt(tmp1*tmp1+tmp2*tmp2);
// }
//
// if(jud<=eps)
// {
// a2=sqrt(fabs(y)*fabs(y)+(a3-jud)*(a3-jud));
// }
// else
// a2=sqrt(fabs(y)*fabs(y)+(a3+jud)*(a3+jud));
//
// // cout<<a1<<" "<<a2<<" "<<a3<<endl;
//
// double A=(a1*a1+a2*a2-a3*a3)/(2.0*a1*a2);
//cout<<A<<endl;
double tmpa=(x-bian)*(x-bian)+y*y;
double tmpb=(x+bian)*(x+bian)+y*y;
double A=(tmpa+tmpb-4.0*bian*bian)/(2*sqrt(tmpa*1.0)*sqrt(tmpb*1.0));
A=acos(A);
//cout<<A<<endl;
A-=(jiao * Pi /180.0);
//A=jiao-A;
// if(A<=eps)
// A=0;
A/=2.0;
double ans=d*tan(A)*2.0;
//cout<<ans<<endl;
//cout<<(ans/kuan/3)<<endl;
int cnt=ceil(ans/kuan);
if(cnt<0)
cnt=0;
cout<<cnt<<endl;
}
return 0;
}
- 版权声明:本文基于《知识共享署名-相同方式共享 3.0 中国大陆许可协议》发布,转载请遵循本协议
- 文章链接:http://www.carlstedt.cn/archives/116 (转载时请注明本文出处及文章链接)


发表评论
快来吐槽一下吧!