hdu 4969 Just a Joke(数学)

来源:互联网 发布:手机上看图软件 编辑:程序博客网 时间:2024/05/22 13:21

题目:

Just a Joke

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 698    Accepted Submission(s): 312


Problem Description
Here is just a joke, and do not take it too seriously.

Guizeyanhua is the president of ACMM, and people call him President Guizeyanhua. When Guizeyanhua is walking on the road, everyone eyes on him with admiration. Recently, Guizeyanhua has fallen in love with an unknown girl who runs along the circular race track on the playground every evening. One evening, Guizeyanhua stood in the center of the circular race track and stared the girl soulfully again. But this time he decided to catch up with the girl because of his lovesickness. He rushed to the girl and intended to show her his love heart. However, he could not run too far since he had taken an arrow in the knee. 

Now your task is coming. Given the maximum distance Guizeyanhua can run, you are asked to check whether he can catch up with the girl. Assume that the values of Guizeyanhua's and the girl's velocity are both constants, and Guizeyanhua, the girl, and the center of the circular race track always form a straight line during the process. Note that the girl and Guizeyanhua can be considered as two points.

 

Input
The input begins with a line containing an integer T (T<=100000), which indicates the number of test cases. The following T lines each contain four integers V1, V2, R, and D (0<V1, V2, R, D<=10^9, V1<=V2). V1 is the velocity of the girl. V2 is the velocity of Guizeyanhua. R is the radius of the race track. D is the maximum distance President Guizeyanhua can run.
 

Output
For each case, output "Wake up to code" in a line if Guizeyanhua can catch up with the girl; otherwise output "Why give up treatment" in a line.
 

Sample Input
21 1 1 111904 41076 3561 3613
 

Sample Output
Why give up treatmentWake up to code
 

Author
SYSU
 

Source
2014 Multi-University Training Contest 9
 

题意:有一个人A站在圆心,有一个人B在圆周上跑,A要追B,A的速度V2,B的速度V1,必须时刻保持A,B和圆心共线,并且A最多跑D米,问A能否追到B。

思路:由于要求它们三点贡献,所以A,B的角速度必须相等,B的角速度为V1/R,A的角速度为Vy/x,Vy为它在相对圆心x米处的切向线速度。列出这个方程,再把Vy代一下,最后用的时间就是Vx的积分,判断这段时间移动的距离是否大于D即可。

代码:

#include <cstdlib>#include <cctype>#include <cstring>#include <cstdio>#include <cmath>#include<climits>#include <algorithm>#include <vector>#include <string>#include <iostream>#include <sstream>#include <map>#include <set>#include <queue>#include <stack>#include <fstream>#include <numeric>#include <iomanip>#include <bitset>#include <list>#include <stdexcept>#include <functional>#include <utility>#include <ctime>using namespace std;#define PB push_back#define MP make_pair#define REP(i,x,n) for(int i=x;i<(n);++i)#define FOR(i,l,h) for(int i=(l);i<=(h);++i)#define FORD(i,h,l) for(int i=(h);i>=(l);--i)#define SZ(X) ((int)(X).size())#define ALL(X) (X).begin(), (X).end()#define RI(X) scanf("%d", &(X))#define RII(X, Y) scanf("%d%d", &(X), &(Y))#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))#define DRI(X) int (X); scanf("%d", &X)#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)#define OI(X) printf("%d",X);#define RS(X) scanf("%s", (X))#define MS0(X) memset((X), 0, sizeof((X)))#define MS1(X) memset((X), -1, sizeof((X)))#define LEN(X) strlen(X)#define F first#define S second#define Swap(a, b) (a ^= b, b ^= a, a ^= b)#define Dpoint  strcut node{int x,y}#define cmpd int cmp(const int &a,const int &b){return a>b;} /*#ifdef HOME    freopen("in.txt","r",stdin);    #endif*/const int MOD = 1e9+7;typedef vector<int> VI;typedef vector<string> VS;typedef vector<double> VD;typedef long long LL;typedef pair<int,int> PII;//#define HOMEint Scan(){int res = 0, ch, flag = 0;if((ch = getchar()) == '-')//判断正负flag = 1;else if(ch >= '0' && ch <= '9')//得到完整的数res = ch - '0';while((ch = getchar()) >= '0' && ch <= '9' )res = res * 10 + ch - '0';return flag ? -res : res;}/*----------------PLEASE-----DO-----NOT-----HACK-----ME--------------------*/int main(){int T;RI(T);while(T--){    int v1,v2,r,d;    scanf("%d%d%d%d",&v1,&v2,&r,&d);    double t=asin((double)v1/(double)v2);    if((double)v2*(double)r/(double)v1*t>d)    {        printf("Why give up treatment\n");    }    else        printf("Wake up to code\n");}        return 0;}


0 0