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 |
看一看吧,毛病在哪阿?#include<stdio.h> int c(float len) { int n=1,k=0; float l=0; for(;k==0;n++) { l+=(float)1/(n+1); if(l>=len) k=n; } return k; } int main() { float m[50]; m[0]=1.0; int i=1,n; for(;m[i-1]!=0;i++) { scanf("%f",&m[i]); } //output for(n=1;m[n]==0;n++) printf("%i card(s)",c(m[n])); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator