| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:poj做的第二题吧,第一次丢了card还给wa了。。诸位知道5.20什么的有什么用么..?In Reply To:poj做的第二题吧,第一次丢了card还给wa了。。诸位知道5.20什么的有什么用么..? Posted by:hyace at 2012-06-09 11:08:44 > //poj做的第二题吧,第一次丢了card还给wa了。。
> //貌似根本不用考虑5.20什么的限制条件?
> #include<stdio.h>
> int main(){
> float a=0;
> while(scanf("%f",&a)!= EOF&&a!=0.00) {
> int i=0;
> float s=0;
> while(s<a)
> s=s+(float)1/(++i+1);
> printf("%d card(s)\n",i);
> }
> return 0;
> }
可以直接计算出不超过5.20所需的最少卡片数
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator