【CodeForces】[667A]Pouring Rain

Problem Description

Loading...

Problem Analysis

A CF round I joined last month
I forgot to write a blog post about it back then

It’s just a cup of water
you drink from it while it keeps being refilled
the question is whether you can finish it
and if so, how many seconds it takes

cpp
 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;
}

Problem link: 【CodeForces】[667A]Pouring Rain

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...