HDU 2552 三足鼎立
思路:arctan(1/s) = arctan(1/u)+arctan(1/v)
1/s = tan(arctan(1/u)+arctan(1/v))
= (tan(arctan(1/u))+tan(arctan(1/v)))/(1-tan(arctan(1/u))*tan(arctan(1/v)))
= (1/u+1/v)/(1-1/uv)
= (u+v)/(uv-1)
su+sv=uv-1
uv-su-sv=1
所以无论s,u是什么值,答案都是1。
代码:
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mem(a,b) memset((a),(b),sizeof(a)) const int INF=0x3f3f3f3f; int main() { int t; scanf("%d",&t); while(t--) { double s,u,v; scanf("%lf%lf",&s,&u); printf("1\n"); } return 0; }