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 an integer value x and a string s consisting of digits from 1 to 9 inclusive. A substring of a string is a contiguous subsequence of that string. Let f(l, r) be the sum of digits of a substring s[l..r] . Let 's call substring s[l_1..r_1] x -prime if You are allowed to erase some characters from the string. If you erase a character, the two resulting parts of the string are concatenated without changing their order. What is the minimum number of characters you should erase from the string so that there are no x -prime substrings in it? If there are no x -prime substrings in the given string s , then print 0 . The first line contains a string s ( 1 <= |s| <= 1000 ). s contains only digits from 1 to 9 inclusive. The second line contains an integer x ( 1 <= x <= 20 ). Print a single integer -- the minimum number of characters you should erase from the string so that there are no x -prime substrings in it. If there are no x -prime substrings in the given string s , then print 0 . In the first example there are two 8 -prime substrings "8" and "53". You can erase these characters to get rid of both: "116285317". The resulting string "1162317" contains no 8 -prime substrings. Removing these characters is also a valid answer: "116285317". In the second example you just have to erase both ones. In the third example there are no 13 -prime substrings. There are no substrings with the sum of digits equal to 13 at all. In the fourth example you can have neither "34", nor "43" in a string. Thus, you have to erase either all threes or all fours. There are 5 of each of them, so it doesn 't matter which. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91097962 |
tyler |
F |
Aug. 27, 2020, 2:19 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
65 |
1435 |
44544000 |
|
|
91553372 |
priority |
F |
Sept. 1, 2020, 9:40 a.m. |
OK |
GNU C++11 |
TESTS |
66 |
46 |
307200 |
|
|
91252380 |
shejunda |
F |
Aug. 29, 2020, 3:03 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
307200 |
|
|
91252240 |
shejunda |
F |
Aug. 29, 2020, 2:58 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
307200 |
|
|
91179677 |
Zars19 |
F |
Aug. 28, 2020, 4:54 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
409600 |
|
|
91139451 |
luogu_bot4 |
F |
Aug. 27, 2020, 2:06 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
1126400 |
|
|
91139375 |
Juanzhang |
F |
Aug. 27, 2020, 2:05 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
1126400 |
|
|
91103079 |
CrSY_Bird |
F |
Aug. 27, 2020, 4:47 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
20480000 |
|
|
91172623 |
charlieyan |
F |
Aug. 28, 2020, 12:57 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
123494400 |
|
|
91265356 |
4790iop |
F |
Aug. 29, 2020, 7:39 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
61 |
20377600 |
|
|
91123195 |
dsgsjk |
F |
Aug. 27, 2020, 10:12 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
61 |
20480000 |
|
|
91209471 |
AghaTizi |
F |
Aug. 28, 2020, 1:01 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
716800 |
|
|
91193870 |
He_Ren |
F |
Aug. 28, 2020, 8:59 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
819200 |
|
|
91159691 |
clyring |
F |
Aug. 27, 2020, 6:12 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
2150400 |
|
|
91159072 |
clyring |
F |
Aug. 27, 2020, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
8396800 |
|
|
91256135 |
George1123 |
F |
Aug. 29, 2020, 4:53 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
20582400 |
|
|
91133849 |
vjudge2 |
F |
Aug. 27, 2020, 12:47 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
100864000 |
|
|
91133800 |
tzxydby |
F |
Aug. 27, 2020, 12:47 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
100864000 |
|
|
91097087 |
liberShip |
F |
Aug. 27, 2020, 1:41 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
61 |
307200 |
|
|
91511613 |
megatron10599 |
F |
Aug. 31, 2020, 4:57 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
61 |
1433600 |
|
|
91337287 |
jjjjj19980806 |
F |
Aug. 30, 2020, 11:18 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
62 |
4608000 |
|
|
91186380 |
ToMmyDong |
F |
Aug. 28, 2020, 7:03 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
46 |
1126400 |
|
|
91269211 |
chielo |
F |
Aug. 29, 2020, 8:38 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
46 |
2150400 |
|
|
91455071 |
yiwangzhifeng |
F |
Aug. 31, 2020, 4:31 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
46 |
3993600 |
|
|
91346562 |
I_wanna_be_number_one |
F |
Aug. 30, 2020, 1:39 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
46 |
4096000 |
|
|
91337832 |
Devil_G |
F |
Aug. 30, 2020, 11:27 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
46 |
4096000 |
|
|
91455118 |
yiwangzhifeng |
F |
Aug. 31, 2020, 4:32 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
46 |
4300800 |
|
|
91152223 |
hiep622032001 |
F |
Aug. 27, 2020, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
46 |
20889600 |
|
|
91106551 |
Random_chen |
F |
Aug. 27, 2020, 5:58 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
46 |
20889600 |
|
|
91454103 |
AM. |
F |
Aug. 31, 2020, 4:16 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
46 |
24166400 |
|
|
91180870 |
sun_of_Ice |
F |
Aug. 28, 2020, 5:21 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
46 |
41369600 |
|
|
91097977 |
tyler |
F |
Aug. 27, 2020, 2:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
31 |
921600 |
|
|
91132308 |
I_am_the_winner_ |
F |
Aug. 27, 2020, 12:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
46 |
1126400 |
|
|
91202140 |
ivan100sic |
F |
Aug. 28, 2020, 11:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
46 |
3584000 |
|
|
91441743 |
oskarfiuk1 |
F |
Aug. 30, 2020, 9:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
46 |
5120000 |
|
|
91169143 |
lucifer1004 |
F |
Aug. 27, 2020, 9:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
46 |
21094400 |
|
|
91244051 |
Capitan |
F |
Aug. 28, 2020, 8:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
46 |
57958400 |
|
|
91144578 |
ycx_girlfriend |
F |
Aug. 27, 2020, 3:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
61 |
819200 |
|
|
91483948 |
JJLeo |
F |
Aug. 31, 2020, 11:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
61 |
10444800 |
|
|
91196001 |
sheaf |
F |
Aug. 28, 2020, 9:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
62 |
20684800 |
|
|
91101097 |
lucifer1004 |
F |
Aug. 27, 2020, 3:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
62 |
101376000 |
|
|
91096401 |
PizzaLovers007 |
F |
Aug. 27, 2020, 1:08 a.m. |
OK |
Java 11 |
TESTS |
65 |
280 |
40038400 |
|
|
91201036 |
azukun |
F |
Aug. 28, 2020, 10:55 a.m. |
OK |
Mono C# |
TESTS |
65 |
140 |
10444800 |
|
|
remove filters
Back to search problems