Enter | Register
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
Codeforces Round 1079 (Div. 2)
A. Friendly Numbers Finished
time limit per test: 1 second
memory limit per test: 256 megabytes → Virtual participation
For an integer x , we call another integer y friendly if the following condition holds: Virtual contest is a way to take part in past
contest, as close as possible to participation
on time. It is supported only ICPC mode for
y − d(y) = x , where d(y) is the sum of the digits of y. virtual contests. If you've seen these
problems, a virtual contest is not for you -
For a given integer x , determine how many friendly numbers it has. solve these problems in the archive. If you
just want to solve some problem from a
contest, a virtual contest is not for you -
Input solve this problem in the archive. Never use
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 500 ). The description of the test cases someone else's code, read the tutorials or
communicate with other person during a
follows. virtual contest.
Each test case consists of a single line containing one integer x (1 ≤ x ≤ 10
9
). Start virtual contest
Output
For each test case, output one integer — the answer to the problem. → Problem tags
Example brute force math
input Copy No tag edit access
3
1 → Contest materials
18
998244360
Announcement
output Copy
0
10
10
Note
The number 1 does not have any friendly numbers.
The number 18 has 10 friendly numbers: These are all the numbers from 20 to 29 . For example, 20 − d(20) = 20 − 2 = 18 .
The number 998 244 360 has 10 friendly numbers:
998 244 400
998 244 401
998 244 402
998 244 403
998 244 404
998 244 405
998 244 406
998 244 407
998 244 408
998 244 409
Codeforces (c) Copyright 2010-2026 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Feb/12/2026 17:27:25UTC+5.5 (g1).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by