Jump to zero (Subtask 3) (retired)
Description:
You are given a positive integer n. For every operation, subtract n by the sum of its digits. Count the number of operations to make n = 0.
For example, with n = 20, you have to use 3 operations. Firstly, n = 20 - (2 + 0) = 18. Secondly, n = 18 - (1 + 8) = 9. Finally, n = 9 - 9 = 0.
You have to answer q such questions.
You can get the original, Vietnamese statement here: https://tleoj.edu.vn/problem/24e
Some subtasks in the original problem have been rewritten to be suitable with Python language
In this subtask, q <= 1 000, n <= 10 ** 5
You can solve each subtask in independent katas:
You have to write a function named jump_to_zero()
which receives an array (of q positive intergers) and returns an array (of q positive intergers).
Example:
- Input:
[18, 19, 20]
- Output:
[2, 2, 3]
There are 201
testcases in the test kit, include:
- Example test (1 test):
[18, 19, 20]
- Subtask 2 (100 tests):
n <= 10 ** 5
- Subtask 3 (100 tests):
n <= 10 ** 6
From TLEoj team with love <3
Similar Kata:
Stats:
Created | Aug 6, 2023 |
Warriors Trained | 41 |
Total Skips | 0 |
Total Code Submissions | 24 |
Total Times Completed | 11 |
Python Completions | 11 |
Total Stars | 1 |
% of votes with a positive feedback rating | 42% of 6 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 7 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |