## COCI '07 Contest 3 #5 Cudak

View as PDF

Points: 15 (partial)
Time limit: 0.6s
Memory limit: 32M

Problem type

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 are there such that the sum of their digits is , and which is the smallest such number?

Write a program that answers Božo's question so that he can get some sleep.

#### Input Specification

The input contains three integers , and .

#### Output Specification

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

#### Scoring

For correctly outputting one of the two numbers you will receive of the score.

Note: if you want to receive credit for just the second number, be sure to output something (, for example) as the first number so the judge can interpret your output correctly.

#### Sample Input 1

1 9 5

#### Sample Output 1

1
5

#### Sample Input 2

1 100 10

#### Sample Output 2

9
19

#### Sample Input 3

11111 99999 24

#### Sample Output 3

5445
11499

• commented on Nov. 9, 2023, 10:07 a.m.

### How to outputting correctly ?

My output is clearly similar to the answer

In test 01:

This output has 0 point

22
106

But this output has 50 points

22

106
• commented on Nov. 14, 2018, 11:28 p.m. edit 2

The test data on this problem is weak, I had a passing solution that would output

1
1

for the data 10 11 1. The correct answer should be

1
10

I have since corrected the mistake in my code though I'm not sure whether my fix works for all cases like that.