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 uppercase Latin letters 'A ' and b letters 'B '. The period of the string is the smallest such positive integer k that s_i = s_{i~mod~k} ( 0 -indexed) for each i . Note that this implies that k won 't always divide a+b = |s| . For example, the period of string "ABAABAA" is 3 , the period of "AAAA" is 1 , and the period of "AABBB" is 5 . Find the number of different periods over all possible strings with a letters 'A ' and b letters 'B '. The first line contains two integers a and b ( 1 <= a, b <= 10^9 ) -- the number of letters 'A ' and 'B ', respectively. Print the number of different periods over all possible strings with a letters 'A ' and b letters 'B '. All the possible periods for the first example: All the possible periods for the second example: Note that these are not the only possible strings for the given periods. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
58446077 |
duxing201606 |
F |
Aug. 7, 2019, 3:34 p.m. |
OK |
GNU C++11 |
TESTS |
54 |
31 |
0 |
|
2800 |
58454352 |
Heltion |
F |
Aug. 7, 2019, 4:21 p.m. |
OK |
GNU C++14 |
TESTS |
54 |
46 |
0 |
|
2800 |
58450924 |
CSWhisky |
F |
Aug. 7, 2019, 4:02 p.m. |
OK |
GNU C++17 |
TESTS |
54 |
31 |
0 |
|
2800 |
58449423 |
tfg |
F |
Aug. 7, 2019, 3:54 p.m. |
OK |
GNU C++17 |
TESTS |
54 |
31 |
0 |
|
2800 |
58449297 |
RUSH_D_CAT |
F |
Aug. 7, 2019, 3:53 p.m. |
OK |
GNU C++17 |
TESTS |
54 |
31 |
1126400 |
|
2800 |
58448615 |
jiangly |
F |
Aug. 7, 2019, 3:49 p.m. |
OK |
GNU C++17 |
TESTS |
54 |
46 |
1126400 |
|
2800 |
remove filters
Back to search problems