Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given a positive integer n . In one move, you can increase n by one (i.e. make n := n + 1 ). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s . You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then t test cases follow. The only line of the test case contains two integers n and s ( 1 <= n <= 10^{18} ; 1 <= s <= 162 ). For each test case, print the answer: the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91901838 |
fpc_coder |
D |
Sept. 5, 2020, 2:38 a.m. |
OK |
FPC |
TESTS |
16 |
171 |
102400 |
|
|
91874163 |
kakayoshi |
D |
Sept. 4, 2020, 4:32 p.m. |
OK |
FPC |
TESTS |
10 |
389 |
0 |
|
|
91876634 |
CmJhLo |
D |
Sept. 4, 2020, 4:38 p.m. |
OK |
GNU C11 |
TESTS |
10 |
124 |
0 |
|
|
91892331 |
shivamrai |
D |
Sept. 4, 2020, 8:22 p.m. |
OK |
GNU C11 |
TESTS |
16 |
124 |
0 |
|
|
91884497 |
Codenthu |
D |
Sept. 4, 2020, 6 p.m. |
OK |
GNU C11 |
TESTS |
16 |
124 |
0 |
|
|
91894220 |
siumai |
D |
Sept. 4, 2020, 9:18 p.m. |
OK |
GNU C11 |
TESTS |
16 |
140 |
6144000 |
|
|
91899532 |
Wenbo888 |
D |
Sept. 5, 2020, 1:15 a.m. |
OK |
GNU C11 |
TESTS |
16 |
171 |
0 |
|
|
91894245 |
sidgarg07 |
D |
Sept. 4, 2020, 9:19 p.m. |
OK |
GNU C11 |
TESTS |
16 |
218 |
0 |
|
|
91901885 |
zdk002 |
D |
Sept. 5, 2020, 2:40 a.m. |
OK |
GNU C11 |
TESTS |
16 |
233 |
0 |
|
|
91878967 |
Minsang |
D |
Sept. 4, 2020, 4:53 p.m. |
OK |
GNU C++11 |
TESTS |
11 |
31 |
0 |
|
|
91872098 |
metadata |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
GNU C++11 |
TESTS |
10 |
31 |
0 |
|
|
91905031 |
luogu_bot4 |
D |
Sept. 5, 2020, 4:02 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91902164 |
vjudge2 |
D |
Sept. 5, 2020, 2:48 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91901700 |
AyaNoAC |
D |
Sept. 5, 2020, 2:34 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91901332 |
minsiqi |
D |
Sept. 5, 2020, 2:21 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91901247 |
terrcota |
D |
Sept. 5, 2020, 2:18 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91908692 |
vjudge1 |
D |
Sept. 5, 2020, 5:20 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91905483 |
vjudge3 |
D |
Sept. 5, 2020, 4:13 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91905437 |
vjudge2 |
D |
Sept. 5, 2020, 4:12 a.m. |
OK |
GNU C++11 |
TESTS |
16 |
46 |
0 |
|
|
91878999 |
Minsang |
D |
Sept. 4, 2020, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
31 |
0 |
|
|
91885195 |
Runtime.error |
D |
Sept. 4, 2020, 6:10 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91882124 |
skull2106 |
D |
Sept. 4, 2020, 5:27 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91899225 |
VagrantAC |
D |
Sept. 5, 2020, 1:01 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91899801 |
Wi1der |
D |
Sept. 5, 2020, 1:26 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91906026 |
coder_xxx |
D |
Sept. 5, 2020, 4:27 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91894086 |
The_Windy_GOD |
D |
Sept. 4, 2020, 9:14 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91894028 |
1pdpraveen |
D |
Sept. 4, 2020, 9:12 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91895655 |
mtnshh |
D |
Sept. 4, 2020, 10:07 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91894931 |
Un_disputed |
D |
Sept. 4, 2020, 9:43 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
46 |
0 |
|
|
91879768 |
ingyu1008 |
D |
Sept. 4, 2020, 5:01 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
31 |
204800 |
|
|
91898608 |
radix.ru |
D |
Sept. 5, 2020, 12:25 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91910610 |
Zexeret |
D |
Sept. 5, 2020, 5:55 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91906303 |
grapo_Oranges |
D |
Sept. 5, 2020, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91904712 |
Testingone |
D |
Sept. 5, 2020, 3:55 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91903697 |
shivamprajapati |
D |
Sept. 5, 2020, 3:30 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91901172 |
hunxuewangzi |
D |
Sept. 5, 2020, 2:15 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91893972 |
MathMate |
D |
Sept. 4, 2020, 9:10 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91893920 |
Joy |
D |
Sept. 4, 2020, 9:08 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91893479 |
___Shallow__ |
D |
Sept. 4, 2020, 8:55 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
46 |
0 |
|
|
91872951 |
sharrad99 |
D |
Sept. 4, 2020, 4:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
31 |
0 |
|
|
91878466 |
sirswaginson |
D |
Sept. 4, 2020, 4:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
31 |
0 |
|
|
91880188 |
smax |
D |
Sept. 4, 2020, 5:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
31 |
0 |
|
|
91889968 |
keepers |
D |
Sept. 4, 2020, 7:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
31 |
0 |
|
|
91910665 |
apsp1234 |
D |
Sept. 5, 2020, 5:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91910734 |
SouravSharma |
D |
Sept. 5, 2020, 5:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91910345 |
BlahDuckling747 |
D |
Sept. 5, 2020, 5:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91909959 |
eThAnE |
D |
Sept. 5, 2020, 5:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91909377 |
BlahDuckling747 |
D |
Sept. 5, 2020, 5:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91910480 |
Moen1578 |
D |
Sept. 5, 2020, 5:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
46 |
0 |
|
|
91901068 |
vamsikonakandla123 |
D |
Sept. 5, 2020, 2:11 a.m. |
OK |
Java 11 |
TESTS |
16 |
202 |
0 |
|
|
91908163 |
yashkundu |
D |
Sept. 5, 2020, 5:11 a.m. |
OK |
Java 11 |
TESTS |
16 |
218 |
0 |
|
|
91872344 |
1NVAL1D |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
Java 11 |
TESTS |
10 |
218 |
0 |
|
|
91895662 |
Apass.Jack |
D |
Sept. 4, 2020, 10:08 p.m. |
OK |
Java 11 |
TESTS |
16 |
233 |
0 |
|
|
91879678 |
Apass.Jack |
D |
Sept. 4, 2020, 5 p.m. |
OK |
Java 11 |
TESTS |
11 |
233 |
0 |
|
|
91871506 |
yuruiyin |
D |
Sept. 4, 2020, 4:27 p.m. |
OK |
Java 11 |
TESTS |
10 |
233 |
0 |
|
|
91873616 |
Apass.Jack |
D |
Sept. 4, 2020, 4:31 p.m. |
OK |
Java 11 |
TESTS |
10 |
264 |
0 |
|
|
91872066 |
TheManWithNoName |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
Java 11 |
TESTS |
10 |
280 |
0 |
|
|
91881248 |
cassiopeia_delphinus |
D |
Sept. 4, 2020, 5:17 p.m. |
OK |
Java 11 |
TESTS |
16 |
296 |
0 |
|
|
91893177 |
breezycamel |
D |
Sept. 4, 2020, 8:47 p.m. |
OK |
Java 11 |
TESTS |
16 |
312 |
0 |
|
|
91905927 |
k_6101 |
D |
Sept. 5, 2020, 4:25 a.m. |
OK |
Java 8 |
TESTS |
16 |
124 |
0 |
|
|
91880802 |
BigBrainInsane |
D |
Sept. 4, 2020, 5:12 p.m. |
OK |
Java 8 |
TESTS |
11 |
124 |
0 |
|
|
91876716 |
anhtaihsgs |
D |
Sept. 4, 2020, 4:39 p.m. |
OK |
Java 8 |
TESTS |
10 |
124 |
0 |
|
|
91871822 |
Abhinav_Mani |
D |
Sept. 4, 2020, 4:27 p.m. |
OK |
Java 8 |
TESTS |
10 |
124 |
0 |
|
|
91881202 |
rachitpts.2454 |
D |
Sept. 4, 2020, 5:16 p.m. |
OK |
Java 8 |
TESTS |
16 |
139 |
0 |
|
|
91873247 |
revanthreddy85 |
D |
Sept. 4, 2020, 4:30 p.m. |
OK |
Java 8 |
TESTS |
10 |
139 |
0 |
|
|
91910190 |
adarshm_26 |
D |
Sept. 5, 2020, 5:48 a.m. |
OK |
Java 8 |
TESTS |
16 |
140 |
0 |
|
|
91909247 |
vengalraoguttha |
D |
Sept. 5, 2020, 5:31 a.m. |
OK |
Java 8 |
TESTS |
16 |
140 |
0 |
|
|
91884366 |
rv6023 |
D |
Sept. 4, 2020, 5:57 p.m. |
OK |
Java 8 |
TESTS |
16 |
140 |
0 |
|
|
91876962 |
Ad-007 |
D |
Sept. 4, 2020, 4:40 p.m. |
OK |
Java 8 |
TESTS |
10 |
140 |
0 |
|
|
91882322 |
koboshi |
D |
Sept. 4, 2020, 5:30 p.m. |
OK |
Kotlin |
TESTS |
16 |
233 |
1945600 |
|
|
91894598 |
Mirimax |
D |
Sept. 4, 2020, 9:29 p.m. |
OK |
Kotlin |
TESTS |
16 |
390 |
0 |
|
|
91893541 |
szechuan_sauce |
D |
Sept. 4, 2020, 8:57 p.m. |
OK |
Mono C# |
TESTS |
16 |
233 |
6860800 |
|
|
91882472 |
fgwiebfaoish |
D |
Sept. 4, 2020, 5:32 p.m. |
OK |
Mono C# |
TESTS |
16 |
1497 |
4505600 |
|
|
91879075 |
Minsang |
D |
Sept. 4, 2020, 4:54 p.m. |
OK |
MS C++ |
TESTS |
11 |
46 |
204800 |
|
|
91902990 |
theweird |
D |
Sept. 5, 2020, 3:11 a.m. |
OK |
MS C++ |
TESTS |
16 |
78 |
0 |
|
|
91879057 |
Minsang |
D |
Sept. 4, 2020, 4:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
46 |
204800 |
|
|
91873573 |
shebao |
D |
Sept. 4, 2020, 4:31 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
46 |
307200 |
|
|
91878703 |
dundae |
D |
Sept. 4, 2020, 4:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
61 |
0 |
|
|
91871572 |
544432 |
D |
Sept. 4, 2020, 4:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
62 |
0 |
|
|
91899268 |
gao_wu_di |
D |
Sept. 5, 2020, 1:03 a.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
124 |
307200 |
|
|
91900400 |
immortal_luo |
D |
Sept. 5, 2020, 1:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
139 |
0 |
|
|
91883334 |
Lowvoice |
D |
Sept. 4, 2020, 5:43 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
139 |
0 |
|
|
91877000 |
Unknown_Hacker |
D |
Sept. 4, 2020, 4:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
140 |
0 |
|
|
91902243 |
immortal_luo |
D |
Sept. 5, 2020, 2:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
171 |
307200 |
|
|
91902736 |
Biang-Biang |
D |
Sept. 5, 2020, 3:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
202 |
0 |
|
|
91876711 |
chaudhary_19 |
D |
Sept. 4, 2020, 4:39 p.m. |
OK |
PyPy 2 |
TESTS |
10 |
623 |
5017600 |
|
|
91879648 |
SuperJ6 |
D |
Sept. 4, 2020, 5 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
655 |
8089600 |
|
|
91876618 |
sksshivam007 |
D |
Sept. 4, 2020, 4:38 p.m. |
OK |
PyPy 2 |
TESTS |
10 |
686 |
6041600 |
|
|
91889725 |
ComptineDunAutreEte |
D |
Sept. 4, 2020, 7:26 p.m. |
OK |
PyPy 2 |
TESTS |
16 |
936 |
8192000 |
|
|
91890350 |
Aka_coder |
D |
Sept. 4, 2020, 7:36 p.m. |
OK |
PyPy 2 |
TESTS |
16 |
951 |
7987200 |
|
|
91889765 |
ComptineDunAutreEte |
D |
Sept. 4, 2020, 7:27 p.m. |
OK |
PyPy 2 |
TESTS |
16 |
951 |
8499200 |
|
|
91889947 |
ComptineDunAutreEte |
D |
Sept. 4, 2020, 7:30 p.m. |
OK |
PyPy 2 |
TESTS |
16 |
982 |
8192000 |
|
|
91872407 |
shehebe |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
PyPy 2 |
TESTS |
10 |
1232 |
8294400 |
|
|
91907759 |
gintoki_s |
D |
Sept. 5, 2020, 5:03 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
264 |
5529600 |
|
|
91871424 |
h5jam |
D |
Sept. 4, 2020, 4:26 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
311 |
9420800 |
|
|
91879504 |
diego.cruz001 |
D |
Sept. 4, 2020, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
358 |
6963200 |
|
|
91902601 |
2019ucp1350 |
D |
Sept. 5, 2020, 3 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
358 |
9113600 |
|
|
91880305 |
lifedev |
D |
Sept. 4, 2020, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
358 |
9216000 |
|
|
91876782 |
KA_Rma |
D |
Sept. 4, 2020, 4:39 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
358 |
9523200 |
|
|
91873513 |
raj1307 |
D |
Sept. 4, 2020, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
374 |
6553600 |
|
|
91877091 |
diego.cruz001 |
D |
Sept. 4, 2020, 4:41 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
374 |
7372800 |
|
|
91887942 |
Rudresh |
D |
Sept. 4, 2020, 6:54 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
374 |
9523200 |
|
|
91879403 |
lifedev |
D |
Sept. 4, 2020, 4:57 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
374 |
9728000 |
|
|
91881662 |
mukul18054 |
D |
Sept. 4, 2020, 5:22 p.m. |
OK |
Python 3 |
TESTS |
16 |
420 |
307200 |
|
|
91872922 |
Sakurakko |
D |
Sept. 4, 2020, 4:30 p.m. |
OK |
Python 3 |
TESTS |
10 |
436 |
819200 |
|
|
91872302 |
sauravsihag |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
Python 3 |
TESTS |
10 |
483 |
307200 |
|
|
91874382 |
_unstable_atom |
D |
Sept. 4, 2020, 4:32 p.m. |
OK |
Python 3 |
TESTS |
10 |
498 |
307200 |
|
|
91894406 |
mlycheetv |
D |
Sept. 4, 2020, 9:24 p.m. |
OK |
Python 3 |
TESTS |
16 |
499 |
307200 |
|
|
91877204 |
karanbantia |
D |
Sept. 4, 2020, 4:41 p.m. |
OK |
Python 3 |
TESTS |
10 |
514 |
307200 |
|
|
91873380 |
rahulguptanitro |
D |
Sept. 4, 2020, 4:30 p.m. |
OK |
Python 3 |
TESTS |
10 |
530 |
614400 |
|
|
91880211 |
rohit__Singh |
D |
Sept. 4, 2020, 5:06 p.m. |
OK |
Python 3 |
TESTS |
11 |
545 |
307200 |
|
|
91873681 |
Nehagrawal |
D |
Sept. 4, 2020, 4:31 p.m. |
OK |
Python 3 |
TESTS |
10 |
546 |
307200 |
|
|
91872146 |
arvind_241999 |
D |
Sept. 4, 2020, 4:28 p.m. |
OK |
Python 3 |
TESTS |
10 |
561 |
307200 |
|
|
91877960 |
Kitsu |
D |
Sept. 4, 2020, 4:46 p.m. |
OK |
Rust |
TESTS |
10 |
1060 |
0 |
|
|
remove filters
Back to search problems