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 |
高手看下老是output问题,在电脑上没问题阿#include <stdio.h> int main() { char m[3]; double s,sum; int i; while(1) { scanf("%c.%c%c",&m[0],&m[1],&m[2]); fflush(stdin); if(m[0]=='0'&&m[1]=='0'&&m[2]=='0')break; s=0; s=m[0]-'0'+(m[1]-'0')/10.0+(m[2]-'0')/100.0; sum=0; i=2; while(sum<s) { sum=sum+1.0/i; i++; } printf("%d card(s)\n",i-2); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator