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

水果!!!!!!!!!!无语!

Posted by wocha at 2012-04-17 22:01:20 on Problem 2509
#include<stdio.h>
int main()
{
	int q,w,n,k;
	while(~scanf("%d%d",&n,&k))
	{
		 q=n;w=0;
		 while(q>=k)
		 {
				q=q/k;
				w+=q*k;
				q=n-q*k+q;
				n=q;
			}
			printf("%d\n",w+q);
	}
}

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