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

怎么回事会WA,还有什么情况没有考虑到???是不是数据精度不够?

Posted by springtty at 2005-07-27 17:15:17 on Problem 2509
#include <stdio.h>

int main()
{
	int n,k,sum;
	scanf("%d %d",&n,&k);

	do
	{
		sum = n;
		while(n/k)
		{
			sum +=(n /=k);
		}
		printf("%d\n",sum);
	}while(scanf("%d %d",&n,&k)!=EOF);
	
	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