Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
2011 F Purple BaseIncrement

2011 F Purple BaseIncrement

Ratings:
(0)
|Views: 0|Likes:
Published by Ric Rad

More info:

Published by: Ric Rad on Aug 25, 2014
Copyright:Traditional Copyright: All rights reserved

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/25/2014

pdf

text

original

 
13
th
South African RegionalACM Collegiate Programming Contest
Sponsored by IBM15 October 2011
Problem F - Purple BalloonBase increment
Problem Description
The numbers you encounter in everyday use are in base 10: for example, 153 means 1
×
10
2
+ 5
×
10
1
+3
×
10
0
. It is also possible to count in other bases. For example, in base 8 the number 153 wouldmean 1
×
8
2
+ 5
×
8
1
+ 3
×
8
0
.To help someone learning to count, you need a program that will accept a number in some base, andoutput the next number in the same base.
Input
Your program must accept multiple scenarios, one per line. Each line contains two positive integers,
b
 and
 n
, separated by a single space.
 b
 will be between 2 and 9 inclusive.
 n
 will be a base
 b
 number.Each digit in
 n
 will be between 0 and
 b
1 inclusive, and the first digit will not be zero.
 n
 will containat most 8 digits.The input will be terminated by a single line containing the value
 
1, equivalent to
 b
 ==
1.
Output
For each line of input containing
 b
 and
 n
, your program must output a line containing
 n
+1, expressedin base
 b
 with no leading zeros.1

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->