<原># UVAlive 7308 Tom and Jerry 【几何数学】

UVAlive 7308 Tom and Jerry 【几何数学】

2016年06月26日 19:17:17 Tabris_ 阅读数:444
标签: 数学 几何 UVA-7308

个人分类: 数学
==== 计算几何 ====


博客爬取于2019-04-18 17:20:39
以下为正文

版权声明:本文为Tabris原创文章,未经博主允许不得私自转载。
https://blog.csdn.net/qq_33184171/article/details/51763961

题目链接: 这里是传送阵。。

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

题目大意 : 就是 Jerry在半径为R的圆上 Tom在圆心 Tom面向Jerry追 Jerry和Tom的速度都是V 问多长时间Tom能追上Jerry

既然Tom 总是面向Jerry 追的 所以Tom的路径就是一个半径为R/2 的半圆 Jerry的路径就是一个半径为R的四分之一圆 时间就可求了

t=2 PI r/4 / v;

附本题代码

————————————–

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <malloc.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>

using namespace std;

const double eps = 1e-7;
const double Pi = acos(-1);


int main()
{
    int t,p=0;
    scanf("%d", &t);
    while(t--)
    {
        int r,v;
        scanf("%d%d",&r,&v);
        long double t;
        t=Pi*r/v/2;

        printf("Case %d: %llf\n",++p,t);
    }
    return 0;
}

 上一篇
<原>#  Light OJ 1007 Mathematically Hard [欧拉函数+前缀和]【数论】 <原># Light OJ 1007 Mathematically Hard [欧拉函数+前缀和]【数论】
这是你自定义的文章摘要内容,如果这个属性有值,文章卡片摘要就显示这段文字,否则程序会自动截取文章的部分内容作为摘要
2016-06-28
下一篇 
<原>#  hdu 1717 && 计蒜课 52 【分数小数的互相转化】【数论?】 <原># hdu 1717 && 计蒜课 52 【分数小数的互相转化】【数论?】
这是你自定义的文章摘要内容,如果这个属性有值,文章卡片摘要就显示这段文字,否则程序会自动截取文章的部分内容作为摘要
2016-06-07
  目录