0% found this document useful (0 votes)
40 views1 page

Problem - 2197A - Codeforces

The document describes a problem from Codeforces Round 1079 (Div. 2) involving friendly numbers, defined as integers y that satisfy the equation y - d(y) = x, where d(y) is the sum of the digits of y. It outlines the input format for multiple test cases and provides examples of how many friendly numbers correspond to given integers. The output for each test case is the count of friendly numbers for the specified integer x.

Uploaded by

Nivash Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views1 page

Problem - 2197A - Codeforces

The document describes a problem from Codeforces Round 1079 (Div. 2) involving friendly numbers, defined as integers y that satisfy the equation y - d(y) = x, where d(y) is the sum of the digits of y. It outlines the input format for multiple test cases and provides examples of how many friendly numbers correspond to given integers. The output for each test case is the count of friendly numbers for the specified integer x.

Uploaded by

Nivash Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like