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 several queries. Each query consists of three integers p , q and b . You need to answer whether the result of p/q in notation with base b is a finite fraction. A fraction in notation with base b is finite if it contains finite number of numerals after the decimal point. It is also possible that a fraction has zero numerals after the decimal point. The first line contains a single integer n ( 1 <= n <= 10^5 ) -- the number of queries. Next n lines contain queries, one per line. Each line contains three integers p , q , and b ( 0 <= p <= 10^{18} , 1 <= q <= 10^{18} , 2 <= b <= 10^{18} ). All numbers are given in notation with base 10 . For each question, in a separate line, print Finite if the fraction is finite and Infinite otherwise. frac{6}{12} = frac{1}{2} = 0,5_{10} frac{4}{3} = 1,(3)_{10} frac{9}{36} = frac{1}{4} = 0,01_2 frac{4}{12} = frac{1}{3} = 0,1_3 '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
38277692 |
avm |
A |
May 15, 2018, 3:03 p.m. |
OK |
D |
TESTS |
88 |
373 |
4403200 |
|
1700 |
38279915 |
Gassa |
A |
May 15, 2018, 3:11 p.m. |
OK |
D |
TESTS |
88 |
717 |
4403200 |
|
1700 |
38556439 |
hadto |
A |
May 23, 2018, 8:59 a.m. |
OK |
GNU C |
TESTS |
89 |
265 |
307200 |
|
1700 |
38621420 |
zhangzhiyuan |
A |
May 26, 2018, 2:51 a.m. |
OK |
GNU C |
TESTS |
89 |
312 |
0 |
|
1700 |
38338582 |
FatLouis |
A |
May 17, 2018, 5:17 a.m. |
OK |
GNU C |
TESTS |
89 |
327 |
307200 |
|
1700 |
38337191 |
MYNAMEISSHARIFUL |
A |
May 17, 2018, 3:37 a.m. |
OK |
GNU C |
TESTS |
89 |
390 |
3379200 |
|
1700 |
40214654 |
PM250 |
A |
July 12, 2018, 1:18 a.m. |
OK |
GNU C++ |
TESTS |
89 |
249 |
0 |
|
1700 |
38713615 |
SuperBlueCat |
A |
May 29, 2018, 8:52 a.m. |
OK |
GNU C++ |
TESTS |
89 |
249 |
0 |
|
1700 |
38412754 |
thx |
A |
May 18, 2018, 11:22 p.m. |
OK |
GNU C++ |
TESTS |
89 |
249 |
0 |
|
1700 |
38308992 |
Jyf624761709 |
A |
May 16, 2018, 5:12 a.m. |
OK |
GNU C++ |
TESTS |
89 |
249 |
3481600 |
|
1700 |
38306509 |
rainy_season |
A |
May 16, 2018, 2:39 a.m. |
OK |
GNU C++ |
TESTS |
89 |
249 |
3481600 |
|
1700 |
40669760 |
HbFS- |
A |
July 23, 2018, 11:58 a.m. |
OK |
GNU C++ |
TESTS |
89 |
264 |
0 |
|
1700 |
40080404 |
luogu_bot4 |
A |
July 8, 2018, 9:06 a.m. |
OK |
GNU C++ |
TESTS |
89 |
264 |
0 |
|
1700 |
39220254 |
HigHwind |
A |
June 13, 2018, 3:15 p.m. |
OK |
GNU C++ |
TESTS |
89 |
264 |
0 |
|
1700 |
38308981 |
Jyf624761709 |
A |
May 16, 2018, 5:12 a.m. |
OK |
GNU C++ |
TESTS |
89 |
264 |
3481600 |
|
1700 |
38318839 |
Jyf624761709 |
A |
May 16, 2018, 11:30 a.m. |
OK |
GNU C++ |
TESTS |
89 |
264 |
3584000 |
|
1700 |
38300725 |
YESMAths |
A |
May 15, 2018, 7:11 p.m. |
OK |
GNU C11 |
TESTS |
88 |
389 |
3379200 |
|
1700 |
38281038 |
Claris |
A |
May 15, 2018, 3:15 p.m. |
OK |
GNU C++11 |
TESTS |
88 |
171 |
3379200 |
|
1700 |
51824968 |
luogu_bot4 |
A |
March 25, 2019, 1:38 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
218 |
0 |
|
1700 |
64346514 |
xumingyang |
A |
Nov. 6, 2019, 6:34 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
64343732 |
xgcjay |
A |
Nov. 6, 2019, 4:49 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
63211815 |
shengzihang |
A |
Oct. 23, 2019, 4:19 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
62660734 |
zhoushouchen |
A |
Oct. 16, 2019, 5:27 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
55485687 |
hychyc |
A |
June 12, 2019, 7:42 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
47535236 |
Clao_015 |
A |
Dec. 27, 2018, 12:17 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
64349845 |
Cesarelg |
A |
Nov. 6, 2019, 7:53 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
0 |
|
1700 |
64346571 |
pufanyi |
A |
Nov. 6, 2019, 6:36 a.m. |
OK |
GNU C++11 |
TESTS |
89 |
233 |
204800 |
|
1700 |
40932100 |
ReaLNero1 |
A |
July 30, 2018, 1:35 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
124 |
0 |
|
1700 |
38319075 |
MrDindows |
A |
May 16, 2018, 11:38 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
124 |
3686400 |
|
1700 |
38319214 |
MrDindows |
A |
May 16, 2018, 11:41 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
124 |
3686400 |
|
1700 |
38318949 |
MrDindows |
A |
May 16, 2018, 11:34 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
139 |
3379200 |
|
1700 |
38311499 |
MrDindows |
A |
May 16, 2018, 6:48 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
139 |
3686400 |
|
1700 |
38318977 |
MrDindows |
A |
May 16, 2018, 11:35 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
156 |
3379200 |
|
1700 |
38319020 |
MrDindows |
A |
May 16, 2018, 11:36 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
156 |
3686400 |
|
1700 |
38332755 |
nk.karpov |
A |
May 16, 2018, 8:55 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
202 |
3379200 |
|
1700 |
38313110 |
abc473848880 |
A |
May 16, 2018, 7:50 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
202 |
3379200 |
|
1700 |
38548511 |
chenyanbo |
A |
May 23, 2018, 12:41 a.m. |
OK |
GNU C++14 |
TESTS |
89 |
233 |
0 |
|
1700 |
38319178 |
MrDindows |
A |
May 16, 2018, 11:40 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
140 |
3686400 |
|
1700 |
46382831 |
Ctalker |
A |
Nov. 29, 2018, 7:37 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
249 |
0 |
|
1700 |
38309867 |
OO_I_LOVE_YZQ__OO |
A |
May 16, 2018, 5:47 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
249 |
3379200 |
|
1700 |
38309959 |
OO_I_LOVE_YZQ__OO |
A |
May 16, 2018, 5:51 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
264 |
4403200 |
|
1700 |
39006399 |
RNS3 |
A |
June 7, 2018, 12:59 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
280 |
0 |
|
1700 |
38394068 |
zjhl2 |
A |
May 18, 2018, 8:07 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
280 |
307200 |
|
1700 |
49517208 |
IIeJlMeHb |
A |
Feb. 6, 2019, 4:30 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
296 |
307200 |
|
1700 |
52592583 |
ytrsk |
A |
April 11, 2019, 6:48 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
311 |
0 |
|
1700 |
57308432 |
vjudge1 |
A |
July 19, 2019, 5:22 a.m. |
OK |
GNU C++17 |
TESTS |
89 |
311 |
0 |
|
1700 |
39520836 |
LiChenKoh |
A |
June 22, 2018, 3:38 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
312 |
0 |
|
1700 |
38298461 |
Martynas |
A |
May 15, 2018, 6:20 p.m. |
OK |
Go |
TESTS |
88 |
390 |
24371200 |
|
1700 |
38308506 |
cheater2k |
A |
May 16, 2018, 4:44 a.m. |
OK |
Go |
TESTS |
89 |
468 |
24371200 |
|
1700 |
49927412 |
ViciousCoder |
A |
Feb. 15, 2019, 12:44 a.m. |
OK |
Java 8 |
TESTS |
89 |
452 |
0 |
|
1700 |
38306577 |
xodiac |
A |
May 16, 2018, 2:42 a.m. |
OK |
Java 8 |
TESTS |
89 |
483 |
20684800 |
|
1700 |
38305387 |
dalt |
A |
May 16, 2018, 1:16 a.m. |
OK |
Java 8 |
TESTS |
88 |
483 |
20787200 |
|
1700 |
40755501 |
aminul |
A |
July 25, 2018, 9:52 p.m. |
OK |
Java 8 |
TESTS |
89 |
498 |
0 |
|
1700 |
38713757 |
rds__98 |
A |
May 29, 2018, 8:58 a.m. |
OK |
Java 8 |
TESTS |
89 |
514 |
0 |
|
1700 |
38460765 |
dipankar12 |
A |
May 20, 2018, 1:15 p.m. |
OK |
Java 8 |
TESTS |
89 |
514 |
0 |
|
1700 |
38312234 |
zephyr_23 |
A |
May 16, 2018, 7:17 a.m. |
OK |
Java 8 |
TESTS |
89 |
514 |
20787200 |
|
1700 |
66299310 |
yaoct |
A |
Dec. 5, 2019, 6:20 a.m. |
OK |
Java 8 |
TESTS |
89 |
530 |
0 |
|
1700 |
47542312 |
kusomushi |
A |
Dec. 27, 2018, 7:52 a.m. |
OK |
Java 8 |
TESTS |
89 |
530 |
0 |
|
1700 |
38342513 |
cxz299 |
A |
May 17, 2018, 8:40 a.m. |
OK |
Java 8 |
TESTS |
89 |
530 |
0 |
|
1700 |
38281575 |
ymatsux |
A |
May 15, 2018, 3:18 p.m. |
OK |
Kotlin |
TESTS |
88 |
561 |
21196800 |
|
1700 |
58604241 |
og.kostya |
A |
Aug. 11, 2019, 1:43 p.m. |
OK |
Mono C# |
TESTS |
89 |
358 |
3072000 |
|
1700 |
38656666 |
kagyi |
A |
May 27, 2018, 1:56 p.m. |
OK |
Mono C# |
TESTS |
89 |
858 |
3174400 |
|
1700 |
46367821 |
vjudge4 |
A |
Nov. 29, 2018, 2:03 p.m. |
OK |
MS C++ |
TESTS |
89 |
343 |
0 |
|
1700 |
42258350 |
zhangyin_ |
A |
Aug. 30, 2018, 12:28 a.m. |
OK |
MS C++ |
TESTS |
89 |
358 |
0 |
|
1700 |
46666482 |
vjudge2 |
A |
Dec. 6, 2018, 2:45 a.m. |
OK |
MS C++ |
TESTS |
89 |
358 |
0 |
|
1700 |
46511633 |
vjudge5 |
A |
Dec. 2, 2018, 1:35 p.m. |
OK |
MS C++ |
TESTS |
89 |
374 |
0 |
|
1700 |
38478316 |
Gleb_Dubosarskii |
A |
May 21, 2018, 9 a.m. |
OK |
MS C++ |
TESTS |
89 |
390 |
0 |
|
1700 |
45502740 |
LoneFox |
A |
Nov. 10, 2018, 8:35 a.m. |
OK |
MS C++ |
TESTS |
89 |
499 |
0 |
|
1700 |
39223912 |
Ivan_Bondarev |
A |
June 13, 2018, 6:10 p.m. |
OK |
MS C++ |
TESTS |
89 |
499 |
0 |
|
1700 |
58334327 |
vjudge1 |
A |
Aug. 5, 2019, 10:51 a.m. |
OK |
MS C++ |
TESTS |
89 |
514 |
0 |
|
1700 |
39280535 |
j4357j |
A |
June 16, 2018, 6:34 a.m. |
OK |
MS C++ |
TESTS |
89 |
529 |
0 |
|
1700 |
38385073 |
Mr_Cao |
A |
May 18, 2018, 12:20 a.m. |
OK |
MS C++ |
TESTS |
89 |
529 |
0 |
|
1700 |
38469314 |
nealzane |
A |
May 20, 2018, 8:41 p.m. |
OK |
Python 2 |
TESTS |
89 |
748 |
2969600 |
|
1700 |
38866028 |
belkka |
A |
June 1, 2018, 7:56 p.m. |
OK |
Python 2 |
TESTS |
89 |
810 |
6041600 |
|
1700 |
38379492 |
dendi239 |
A |
May 17, 2018, 6:41 p.m. |
OK |
Python 2 |
TESTS |
89 |
811 |
3481600 |
|
1700 |
38379515 |
dendi239 |
A |
May 17, 2018, 6:44 p.m. |
OK |
Python 2 |
TESTS |
89 |
826 |
1638400 |
|
1700 |
38335767 |
belkka |
A |
May 17, 2018, 1:36 a.m. |
OK |
Python 2 |
TESTS |
89 |
841 |
7680000 |
|
1700 |
48577981 |
conjecture_xyz |
A |
Jan. 19, 2019, 3:05 p.m. |
OK |
Python 2 |
TESTS |
89 |
842 |
1740800 |
|
1700 |
38866005 |
belkka |
A |
June 1, 2018, 7:54 p.m. |
OK |
Python 2 |
TESTS |
89 |
842 |
7680000 |
|
1700 |
38299853 |
Wild_Hamster |
A |
May 15, 2018, 6:47 p.m. |
OK |
Python 2 |
TESTS |
88 |
873 |
6041600 |
|
1700 |
38316710 |
ErdemKirez |
A |
May 16, 2018, 10:15 a.m. |
OK |
Python 2 |
TESTS |
89 |
888 |
7680000 |
|
1700 |
38301267 |
mjhun |
A |
May 15, 2018, 7:33 p.m. |
OK |
Python 2 |
TESTS |
88 |
936 |
7680000 |
|
1700 |
38471926 |
orailly |
A |
May 21, 2018, 12:39 a.m. |
OK |
Python 3 |
TESTS |
89 |
608 |
18227200 |
|
1700 |
38335590 |
belkka |
A |
May 17, 2018, 1:15 a.m. |
OK |
Python 3 |
TESTS |
89 |
608 |
19046400 |
|
1700 |
38316257 |
Yee_172 |
A |
May 16, 2018, 9:57 a.m. |
OK |
Python 3 |
TESTS |
89 |
639 |
18022400 |
|
1700 |
38318740 |
Yee_172 |
A |
May 16, 2018, 11:27 a.m. |
OK |
Python 3 |
TESTS |
89 |
670 |
18022400 |
|
1700 |
38285828 |
Eran |
A |
May 15, 2018, 3:39 p.m. |
OK |
Python 3 |
TESTS |
88 |
748 |
24678400 |
|
1700 |
59538450 |
Sevlll |
A |
Aug. 26, 2019, 5:52 p.m. |
OK |
Python 3 |
TESTS |
89 |
779 |
4300800 |
|
1700 |
48581932 |
.tx |
A |
Jan. 19, 2019, 5:03 p.m. |
OK |
Python 3 |
TESTS |
89 |
779 |
4505600 |
|
1700 |
38316399 |
Yee_172 |
A |
May 16, 2018, 10:03 a.m. |
OK |
Python 3 |
TESTS |
89 |
811 |
11161600 |
|
1700 |
38468736 |
cristi.dana2 |
A |
May 20, 2018, 8:01 p.m. |
OK |
Python 3 |
TESTS |
89 |
826 |
4198400 |
|
1700 |
38335753 |
belkka |
A |
May 17, 2018, 1:33 a.m. |
OK |
Python 3 |
TESTS |
89 |
857 |
10956800 |
|
1700 |
remove filters
Back to search problems