cudak (PDF)




File information


This PDF 1.5 document has been generated by cairo 1.10.2 (http://cairographics.org), and has been sent on pdf-archive.com on 10/11/2017 at 09:00, from IP address 89.165.x.x. The current document download page has been viewed 235 times.
File size: 112.26 KB (1 page).
Privacy: public file




Document preview - cudak.pdf - Page 1/1





File preview


5. CUDAK
Božo is a strange little boy. Every day he tires his friends with strange questions. Today's question is:
how many integers in the interval [A, B] are there such that the sum of their digits is S, and which is the
smallest such number?
Write a program that answers Božo's question so that he can get some sleep.

Input
The input contains three integers A, B and S (1 ≤ A ≤ B < 1015, 1 ≤ S ≤ 135).

Output
The first line should contain the number of integers in the interval with the digit sum equal to S.
The second line should contain the smallest such integer.
The input data will guarantee that the first number is at least 1.

Scoring
For correctly outputting one of the two numbers you will receive 50% of the score.
Note: if you want to receive credit for just the second number, be sure to output something (0, for
example) as the first number so the judge can interpret your output correctly.

Sample test data
input

input

input

1 9 5

1 100 10

11111 99999 24

output

output

output

1
5

9
19

5445
11499

Croatian Open Competition in Informatics, contest 3 – December 8, 2007






Download cudak



cudak.pdf (PDF, 112.26 KB)


Download PDF







Share this file on social networks



     





Link to this page



Permanent link

Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..




Short link

Use the short link to share your document on Twitter or by text message (SMS)




HTML Code

Copy the following HTML code to share your document on a Website or Blog




QR Code to this page


QR Code link to PDF file cudak.pdf






This file has been shared publicly by a user of PDF Archive.
Document ID: 0000695557.
Report illicit content