1606: nc與滴水問題
Time Limit: 1000 MS Memory Limit: 64 MBSubmit: 85 Solved: 27
[Submit][Status][Web Board]
Description
nc最近很無聊~所以他總是想各種有趣的問題來打發時間。
nc的宿舍水龍頭在漏水,他只好拿一個水桶去接水,他很好奇至少過多久這個水桶會裝滿水。已知水桶是圓柱體,底面直徑爲D,高爲H;又知道水龍頭每K秒會滴下一滴水滴,我們假設水滴爲球體,其半徑爲R。由於nc很懶,你需要幫他計算出至少過多久水桶裏可以裝滿水。
Input
第一行爲T。表示有T組數據。
以下T行,每行有4個整數D,H,K,R。(1<=D,H,K,R<=10^9)。
Output
輸出T行。
每行一個整數,表示水桶裝滿水的時間。
Sample Input
16 9 1 3
6 9 2 2
Sample Output
16
HINT
Source
題目鏈接:
http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1606
題目大意:
有一個圓柱體水桶底面直徑爲D,高爲H,水龍頭每K秒會滴下一滴水滴,水滴爲球體,半徑爲R,問多久水桶裝滿水
題目思路:
【模擬】
這題就數學公式算一下水桶體積和水滴的體積。然後除一下就好。
注意double的精度可能會有誤差。
還有這題是隻進不捨
/****************************************************
Author : Coolxxx
Copyright 2017 by Coolxxx. All rights reserved.
BLOG : http://blog.csdn.net/u010568270
****************************************************/
#include<bits/stdc++.h>
#pragma comment(linker,"/STACK:1024000000,1024000000")
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define mem(a,b) memset(a,b,sizeof(a))
const double EPS=1e-8;
const int J=10000;
const int MOD=100000007;
const int MAX=0x7f7f7f7f;
const double PI=3.14159265358979323;
const int N=104;
using namespace std;
typedef long long LL;
double anss;
LL aans;
int cas,cass;
int n,m,lll,ans;
int e[N][N],f[N][N];
void floyd()
{
int i,j,k;
for(k=1;k<=n;k++)
{
for(i=1;i<=n;i++)
{
if(i==k)continue;
for(j=1;j<=n;j++)
{
if(i==j || k==j)continue;
f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
}
}
}
}
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k,l;
int x,y,z;
for(scanf("%d",&cass);cass;cass--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s))
// while(~scanf("%d",&n))
{
LL K;
double D,H,R;
scanf("%lf%lf%lld%lf",&D,&H,&K,&R);
double V=sqr(D/2)*H;
double T=V/R/R/R/4*3;
LL t=LL(T);
if(T>t)t++;
t=t*K;
printf("%lld\n",t);
}
return 0;
}
/*
//
//
*/