码迷,mamicode.com
首页 > 其他好文 > 详细

2016 省赛热身 In the Rain

时间:2016-04-30 20:48:24      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

In the Rain
Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu
 

Description

Fujiwara no Mokou was formerly an ordinary human, but she became an immortal being after drinking the Hourai Elixir about 1300 years ago. She has some sort of control over fire.

技术分享

One day, Mokou was on the way home after cutting bamboo. Suddenly it began to rain. As a manipulator of fire, Mokou dislikes rains. So she ran to her home as quickly as possible.

We can regard Mokou as a cylinder. The path can be simplified as a line. Mokou started from (0, 0, 0) and her home is at (x0, 0, 0). It is supposed that the rain is continuous and its density is 1. The rain will be absorbed immediately when it touches the surface of the cylinder or the ground. You need to measure how much weight of rain was absorbed by Mokou during her way to home in the rain.

Input

There are multiple cases. The first line of the input contains an integer T (1 ≤ T ≤ 200) which indicates the number of cases. For each test case:
The first line contains four integers RHVx0, the radius, height and speed of the cylinder and the location of Mokou‘s house.
The second line contains three integers dxdy and dz, the speed of the rain.
All integers in input are no less than -1000 and no larger than 1000. Test data satisfy that RHVx0 > 0, dz < 0.

Output

For each case, output the total weight of rain which was absorbed by Mokou. Absolute or relative error no more than 1E-6 will be accepted. 

Sample Input

2
1 1 1 1
0 0 -1
2 3 3 3
2 3 -3

Sample Output

5.1415926536
75.6464437651
简单题意:
   给出起始位置,家的位置,,然后给出速度,,下雨的dx, dy, dz三个方向的速度。题目假设人是一个圆通,但是可以吸收水分,然后计算人吸收扑了多少水分;
思路分析:
  这道题目的关键在于对吸收水分的理解(并不是只有圆通的顶部吸水),以及对相对面积的求解,,并不是很难。。

# include <iostream>
# include <cmath>
# include <cstdio>
using namespace std;
const double PI = acos(-1.0);

int main()
{
    int t;
    scanf("%d", &t);
    while(t--)
    {
        double r, h, v, x0;
        double dx, dy, dz;
        scanf("%lf %lf %lf %lf %lf %lf %lf", &r, &h, &v, &x0, &dx, &dy, &dz);
        dx = dx - v;
        double sqrtt = sqrt(dx * dx + dy * dy + dz * dz);
        double sinjiao = dz / sqrtt;
        double cosjiao = sqrt(dx * dx + dy * dy) / sqrtt;

        double s = fabs(PI * r * r * sinjiao) + fabs(2 * r * h * cosjiao);
        double t = x0 / v;

        printf("%.10f\n", s * sqrtt * t);
    }

    return 0;
}

 




2016 省赛热身 In the Rain

标签:

原文地址:http://www.cnblogs.com/lyf-acm/p/5449268.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!