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 |
瞬间ac。#include<stdio.h> int main() { int i; double n,sum; while(scanf("%lf",&n)!=EOF&&n) { sum=0.0; for(i=2;i<10000;i++) { sum=sum+1.0/i; if(sum>n) break; } printf("%d card(s)\n",i-1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator