Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

高手看下老是output问题,在电脑上没问题阿

Posted by jianxiao at 2008-07-17 16:09:55 on Problem 1003
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator