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'Bike is a smart boy who loves math very much. He invented a number called "Rotatable Number" inspired by 142857. As you can see, 142857 is a magic number because any of its rotatings can be got by multiplying that number by 1, xe2 x80 x892, xe2 x80 x89..., xe2 x80 x896 (numbers from one to number 's length). Rotating a number means putting its last several digit into first. For example, by rotating number 12345 you can obtain any numbers: 12345, xe2 x80 x8951234, xe2 x80 x8945123, xe2 x80 x8934512, xe2 x80 x8923451. It 's worth mentioning that leading-zeroes are allowed. So both 4500123 and 0123450 can be obtained by rotating 0012345. You can see why 142857 satisfies the condition. All of the 6 equations are under base 10. Now, Bike has a problem. He extends "Rotatable Number" under any base b. As is mentioned above, 142857 is a "Rotatable Number" under base 10. Another example is 0011 under base 2. All of the 4 equations are under base 2. So, he wants to find the largest b (1 xe2 x80 x89< xe2 x80 x89b xe2 x80 x89< xe2 x80 x89x) so that there is a positive "Rotatable Number" (leading-zeroes allowed) of length n under base b. Note that any time you multiply a rotatable number by numbers from 1 to its length you should get a rotating of that number. The only line contains two space-separated integers n, xe2 x80 x89x (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x895 xc2 xb7106, xe2 x80 x892 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109). Print a single integer -- the largest b you found. If no such b exists, print -1 instead. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
3712422 |
Golovanov399 |
D |
May 12, 2013, 3:36 p.m. |
OK |
Delphi |
TESTS |
56 |
46 |
0 |
|
2500 |
11669571 |
ljz |
D |
June 19, 2015, 2:08 p.m. |
OK |
FPC |
TESTS |
57 |
62 |
102400 |
|
2500 |
8865973 |
SHUXK |
D |
Nov. 27, 2014, 4:52 a.m. |
OK |
FPC |
TESTS |
57 |
92 |
0 |
|
2500 |
3717095 |
Um_nik |
D |
May 13, 2013, 2:21 p.m. |
OK |
FPC |
TESTS |
57 |
203 |
6041600 |
|
2500 |
3903544 |
WuxinyuJason |
D |
June 16, 2013, 2:19 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3856154 |
scli |
D |
June 11, 2013, 6:17 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3820252 |
I_so_sad |
D |
June 4, 2013, 1:26 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3762445 |
ZeForce |
D |
May 24, 2013, 1:37 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3736119 |
rng_58 |
D |
May 19, 2013, 9:40 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3729651 |
sspa |
D |
May 17, 2013, 1:23 p.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3723621 |
gxnncrx1993 |
D |
May 15, 2013, 1:15 p.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3720493 |
delta_4d |
D |
May 14, 2013, 2:21 p.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3719940 |
asklzxn2 |
D |
May 14, 2013, 11:39 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3718944 |
BSBandme |
D |
May 14, 2013, 5:14 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3720811 |
error202 |
D |
May 14, 2013, 3:46 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
15 |
0 |
|
2500 |
8865461 |
equation314 |
D |
Nov. 27, 2014, 2:55 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
60 |
0 |
|
2500 |
6981396 |
mislav_bradac |
D |
June 29, 2014, 4:39 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
60 |
0 |
|
2500 |
10257748 |
pwild |
D |
March 13, 2015, 12:54 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
60 |
102400 |
|
2500 |
10146378 |
Pudge123 |
D |
March 4, 2015, 12:11 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
62 |
0 |
|
2500 |
9298100 |
zshi |
D |
Dec. 29, 2014, 12:57 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
62 |
0 |
|
2500 |
8976724 |
zhj |
D |
Dec. 4, 2014, 4:46 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
62 |
0 |
|
2500 |
3713123 |
cocls |
D |
May 12, 2013, 4:15 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
78 |
20582400 |
|
2500 |
8715904 |
desert97 |
D |
Nov. 17, 2014, 5:47 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
312 |
102400 |
|
2500 |
12955930 |
nuonuo |
D |
Sept. 11, 2015, 9:19 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
0 |
|
2500 |
10615543 |
sdya |
D |
April 6, 2015, 6:33 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
0 |
|
2500 |
14470349 |
Altria-PenDragon |
D |
Nov. 25, 2015, 1:50 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
614400 |
|
2500 |
17130626 |
freebsdx |
D |
April 2, 2016, 1:12 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
2048000 |
|
2500 |
18370885 |
AbstractKangaroo |
D |
June 11, 2016, 8:20 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
6246400 |
|
2500 |
39434863 |
krybom |
D |
June 20, 2018, 11:52 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
60 |
0 |
|
2500 |
12956006 |
nuonuo |
D |
Sept. 11, 2015, 9:24 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
60 |
0 |
|
2500 |
62185478 |
luogu_bot1 |
D |
Oct. 9, 2019, 8:07 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
0 |
|
2500 |
57459036 |
fsyfsy |
D |
July 21, 2019, 12:49 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
0 |
|
2500 |
57458991 |
fsyfsy |
D |
July 21, 2019, 12:48 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
0 |
|
2500 |
29022321 |
SakurakoujiRuna |
D |
July 30, 2017, 6:04 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
30 |
1945600 |
|
2500 |
23661584 |
Ali.Pi |
D |
Jan. 9, 2017, 7:20 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
30 |
2662400 |
|
2500 |
56379234 |
Scut82 |
D |
July 1, 2019, 7:46 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
60 |
0 |
|
2500 |
56376091 |
Scut82 |
D |
July 1, 2019, 6:36 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
0 |
|
2500 |
67273136 |
ElangBondol |
D |
Dec. 20, 2019, 9:08 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
204800 |
|
2500 |
28578496 |
LiChenKoh |
D |
July 15, 2017, 4:46 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
7987200 |
|
2500 |
28578489 |
LiChenKoh |
D |
July 15, 2017, 4:45 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
7987200 |
|
2500 |
26289680 |
THOOR_001 |
D |
April 11, 2017, 4:37 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
1945600 |
|
2500 |
37798168 |
Random_chen |
D |
May 1, 2018, 12:22 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
48435200 |
|
2500 |
37797964 |
Random_chen |
D |
May 1, 2018, 12:14 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
48435200 |
|
2500 |
52884118 |
ruo |
D |
April 17, 2019, 3:32 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
60 |
0 |
|
2500 |
67452782 |
Anachor |
D |
Dec. 23, 2019, 5:19 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
0 |
|
2500 |
65670146 |
sir_ementaler |
D |
Nov. 24, 2019, 3:35 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
0 |
|
2500 |
44727357 |
majk |
D |
Oct. 23, 2018, 8:39 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
0 |
|
2500 |
44727676 |
majk |
D |
Oct. 23, 2018, 8:48 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
204800 |
|
2500 |
44727805 |
majk |
D |
Oct. 23, 2018, 8:52 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
307200 |
|
2500 |
44727334 |
majk |
D |
Oct. 23, 2018, 8:39 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
307200 |
|
2500 |
44701723 |
majk |
D |
Oct. 22, 2018, 3:04 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
307200 |
|
2500 |
61701990 |
vjudge4 |
D |
Oct. 2, 2019, 8:50 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
248 |
54067200 |
|
2500 |
61724847 |
dorijanlendvaj |
D |
Oct. 2, 2019, 3:04 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
748 |
231936000 |
|
2500 |
3717480 |
sayuan |
D |
May 13, 2013, 4:17 p.m. |
OK |
Java 6 |
TESTS |
57 |
93 |
0 |
|
2500 |
3712515 |
uwi |
D |
May 12, 2013, 3:39 p.m. |
OK |
Java 6 |
TESTS |
56 |
93 |
0 |
|
2500 |
3713936 |
slycelote |
D |
May 12, 2013, 6:36 p.m. |
OK |
Java 6 |
TESTS |
57 |
93 |
102400 |
|
2500 |
4056057 |
ffao |
D |
July 12, 2013, 6:37 p.m. |
OK |
Java 7 |
TESTS |
57 |
78 |
0 |
|
2500 |
3728252 |
sweiss |
D |
May 16, 2013, 7:29 p.m. |
OK |
Java 7 |
TESTS |
57 |
78 |
0 |
|
2500 |
3734491 |
API |
D |
May 18, 2013, 6:15 p.m. |
OK |
Java 7 |
TESTS |
57 |
93 |
0 |
|
2500 |
3712240 |
Hitrez |
D |
May 12, 2013, 3:22 p.m. |
OK |
Java 7 |
TESTS |
56 |
93 |
0 |
|
2500 |
3708607 |
Petr |
D |
May 12, 2013, 1:48 p.m. |
OK |
Java 7 |
TESTS |
56 |
734 |
102400 |
|
2500 |
6952038 |
winger |
D |
June 24, 2014, 9:59 a.m. |
OK |
Java 8 |
TESTS |
57 |
560 |
0 |
|
2500 |
3714946 |
BIT_silence |
D |
May 13, 2013, 3:40 a.m. |
OK |
MS C++ |
TESTS |
57 |
15 |
0 |
|
2500 |
3715646 |
ONU_1785 |
D |
May 13, 2013, 7:46 a.m. |
OK |
MS C++ |
TESTS |
57 |
15 |
102400 |
|
2500 |
62933768 |
Xijian1999 |
D |
Oct. 19, 2019, 1:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
57 |
62 |
0 |
|
2500 |
remove filters
Back to search problems