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

還是不能submit裏面打啊,白白搞了一次CE

Posted by KatrineYang at 2016-11-06 09:59:13 on Problem 2509
rt
#include <stdio.h>

int main() {
	while(1){
		int n,k;
		if(scanf("%d%d", &n, &k) != 2) break;
		int t = 0;
		int z = n, s = 0;
		while(1){
			t += z;
			s += z;
			z = s/k;
			s = s%k;
			if(!z) break;
		}
		printf("%d\n", t);
	}
	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