【CodeForces】[667A]Pouring Rain

文章字数:137

问题描述

问题分析

上个月参加的一场CF
当时忘了写博客了

就是有一杯水
一边喝一边添
问能否喝完
并问如果能那么需要多少秒

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<math.h>
#define PI acos(-1.0)
int main() {
	int d,h,v,e;
	while(scanf("%d %d %d %d",&d,&h,&v,&e)!=EOF) {
		double S=PI*((d/2.0)*(d/2.0));
		double gv=S*e;
		if(gv>v) {
			printf("NO\n");
			continue;
		} else {
			printf("YES\n");
			printf("%lf\n",h*S/(v-gv));
		}
	}
	return 0;
}

题目地址:【CodeForces】[667A]Pouring Rain

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...