F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

¡°Base B¡±

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 355    Accepted Submission(s): 175


Problem Description
AekdyCoin is so fond of math.He loves Number.He knows how to express a non-negative number into P base.Say,he knows that the number 71 in 2 Base is exactly ¡°1000111¡±. But AekdyCoin doesn¡¯t think it¡¯s a proper way to express a number.AekdyCoin want to creat the ¡°Base B¡±,whose digits¡¯ value is not only equal or larger than A,but also smaller than A+B.For example,if A = 1,B = 5,then AekdyCoin could express number 65 in ¡°Base 5¡± ,it is ¡°225¡± definitely .(But Not ¡°230¡±,0 is out of the range [1,5]!)
AekdyCoin is quite exciting about his ¡°invention¡±,now he hopes that you could write a program for him which could help him to express a number in ¡°Base B¡±.
 

Input
The input consists of several test cases.

Every case has only three integers indicating N,A,B (0<=N<=10^9,0<=A<=100,2<=B<=100)
 

Output
For each case,you should output ¡°Case x:¡± first where x is the case index.(x>=1).
  Then output the expression in ¡°Base B¡±,if the number of digit is more than one,you should split them with exactly one ¡® ¡®.
  We guarantee there is always a solution.
 

Sample Input
65 1 5 15 0 2
 

Sample Output
Case 1: 2 2 5 Case 2: 1 1 1 1
 

Hint

Hint:
In case 1, 65 = 2 * 5^2 + 2 * 5 + 5 * 1,and all digits are in the range[1,5].
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 17:11:36, Gzip enabled