Tom and Jerry
2017-04-30 16:48
148 查看
Tom and Jerry are very fond of cat and mice games, which might be rather obvious to you. Today they
are playing a very complicated game. The goals are simple as usual though, Jerry would be running
and Tom would have to catch Jerry.
However, today Jerry is running on a perfect circular
path with radius R meters, at a constant speed of
V m/s. Initially Tom is sitting at the very center of
the circle. He wants to catch Jerry as soon as possible,
but we all know, Tom is not very intelligent. Instead
of calculating an optimal direction to catch Jerry, he is
just running towards Jerry.
As Jerry is also moving, the path Tom has taken
start to look like a curve (see picture above). At any
given moment, Tom’s position is between Jerry’s current
position and the center of the circle. Tom is also
moving at a constant speed of V m/s, same speed as
Jerry. Find the time (in seconds) Tom would need to
catch Jerry.
Input
Input file has T (T ≤ 10000) test cases, each case consists of two integer R and V . Here, 0 < R, V ≤
10000.
Output
For each test case, print the case number and the time Tom will need to catch Jerry. Floating point
rounding error lower than 10−5 will be ignored by the judge.
Sample Input
4
45 100
5 1547
1000 10000
5668 5467
Sample Output
Case 1: 0.70685835
Case 2: 0.00507691
Case 3: 0.15707963
Case 4: 1.62854830
题意:
圆,半径为R,Jerry以速度V在圆周上移动,Tom在圆心以同样的速度始终面向Jerry跑去,即在任意时刻,Tom,Jerry,圆心总在同一直线,问Tom追到Jerry所需时间
思路:
几何问题,Tom一直面向Jerry跑去,可推出当Tom追到Jerry时,Jerry走过了半径为R的1/4圆周,Tom走了半径为R/2的1/2圆周,那么时间等于2*PI*R/4/V
are playing a very complicated game. The goals are simple as usual though, Jerry would be running
and Tom would have to catch Jerry.
However, today Jerry is running on a perfect circular
path with radius R meters, at a constant speed of
V m/s. Initially Tom is sitting at the very center of
the circle. He wants to catch Jerry as soon as possible,
but we all know, Tom is not very intelligent. Instead
of calculating an optimal direction to catch Jerry, he is
just running towards Jerry.
As Jerry is also moving, the path Tom has taken
start to look like a curve (see picture above). At any
given moment, Tom’s position is between Jerry’s current
position and the center of the circle. Tom is also
moving at a constant speed of V m/s, same speed as
Jerry. Find the time (in seconds) Tom would need to
catch Jerry.
Input
Input file has T (T ≤ 10000) test cases, each case consists of two integer R and V . Here, 0 < R, V ≤
10000.
Output
For each test case, print the case number and the time Tom will need to catch Jerry. Floating point
rounding error lower than 10−5 will be ignored by the judge.
Sample Input
4
45 100
5 1547
1000 10000
5668 5467
Sample Output
Case 1: 0.70685835
Case 2: 0.00507691
Case 3: 0.15707963
Case 4: 1.62854830
题意:
圆,半径为R,Jerry以速度V在圆周上移动,Tom在圆心以同样的速度始终面向Jerry跑去,即在任意时刻,Tom,Jerry,圆心总在同一直线,问Tom追到Jerry所需时间
思路:
几何问题,Tom一直面向Jerry跑去,可推出当Tom追到Jerry时,Jerry走过了半径为R的1/4圆周,Tom走了半径为R/2的1/2圆周,那么时间等于2*PI*R/4/V
相关文章推荐
- Hello.Java//Tom and Jerry
- Tom and Jerry
- OJ.Tom and Jerry
- 南邮 OJ 1058 Tom and Jerry
- 观察者模式之Tom and Jerry
- noj 1058 Tom and Jerry
- Tom and Jerry
- EOJ 1162 tom and jerry bfs
- Tom and Jerry
- Tom and Jerry
- Hrbust 2292 Tom and Jerry【树上最短路+枚举】
- Tom and Jerry
- Tom and Jerry
- Tom and Jerry
- 【SPOJ-TOMJERRY】Tom and Jerry【概率DP】【记忆化搜索】
- 1058-Tom and Jerry
- 从键盘上输入以下的数据:"TOM:89|JERRY:90|TONY:95",数据格式为“姓名:成绩|姓名:成绩|姓名:成绩”,对输入的内容按成绩进行排序,并将结果按成绩由高到低排序。
- hdu5225---Tom and permutation(规律,枚举+乱搞)
- HDU_5224 Tom and paper
- 【HDU】5227 Tom and game【快速求gcd值+点分治】