Problem - 1593B - Codeforces
Problem - 1593B - Codeforces
|
riteshnub | Logout
You have +385! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
00:00:03
Clone Contest
Each test case consists of one line containing one integer n (25 ≤ n ≤ 1018 ). It is
guaranteed that, for each n occurring in the input, the answer exists. It is guaranteed that the
number n has no leading zeros.
→ Submit?
Output
For each test case output on a separate line an integer k (k ≥ 0) — the minimum number of Language: GNU G++17 7.3.0
steps to get a number such that it is divisible by 25 and positive.
Choose
Choose File No file chosen
file:
Example
input Copy Submit
5
100
71345 → Problem tags
3259
50555 dfs and similar dp greedy math
2050047
math *900
output Copy
No tag edit access
0
3
1 → Contest materials
3
2 Announcement
Note Tutorial
In the first test case, it is already given a number divisible by 25 .
In the second test case, we can remove the digits 1, 3, and 4 to get the number 75 .
In the third test case, it's enough to remove the last digit to get the number 325.
In the fourth test case, we can remove the three last digits to get the number 50 .
In the fifth test case, it's enough to remove the digits 4 and 7.
https://codeforces.com/problemset/problem/1593/B 1/2
4/1/24, 8:58 AM Problem - 1593B - Codeforces
Supported by
https://codeforces.com/problemset/problem/1593/B 2/2