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 have given integers a , b , p , and q . Let f(x) = text{abs}( text{sin}( frac{p}{q} pi x)) . Find minimum possible integer x that maximizes f(x) where a <= x <= b . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 100 ) -- the number of test cases. The first line of each test case contains four integers a , b , p , and q ( 0 <= a <= b <= 10^{9} , 1 <= p , q <= 10^{9} ). Print the minimum possible integer x for each test cases, separated by newline. In the first test case, f(0) = 0 , f(1) = f(2) approx 0.866 , f(3) = 0 . In the second test case, f(55) approx 0.999969 , which is the largest among all possible values. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
61306774 |
yyf0309 |
F |
Sept. 26, 2019, 7:36 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
59941911 |
Big_black_jujube |
F |
Sept. 3, 2019, 11:45 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
59425969 |
AloneKnight |
F |
Aug. 25, 2019, 2:29 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
57865448 |
lopare |
F |
July 27, 2019, 8:40 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
57847703 |
Rubbish12345 |
F |
July 27, 2019, 11:53 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
57709804 |
py_ultron |
F |
July 24, 2019, 10:50 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
56291967 |
AThousandMoon |
F |
June 30, 2019, 2:08 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
56227807 |
Zhang_RQ |
F |
June 28, 2019, 1:17 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
56226854 |
Zhang_RQ |
F |
June 28, 2019, 12:55 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
64287222 |
rausen |
F |
Nov. 5, 2019, 5:27 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
0 |
|
2900 |
55468373 |
HYDROXIDE |
F |
June 11, 2019, 5:28 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
0 |
|
2900 |
66588636 |
zafkiel |
F |
Dec. 10, 2019, 12:10 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
56779827 |
fstqaq |
F |
July 10, 2019, 5:37 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
56779652 |
fstqaq |
F |
July 10, 2019, 5:30 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
55993309 |
gtrhetr |
F |
June 24, 2019, 8:54 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
55988160 |
Pokeylope |
F |
June 24, 2019, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
55533002 |
yan-zp |
F |
June 13, 2019, 2:40 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
31 |
0 |
|
2900 |
55479208 |
superguymj |
F |
June 12, 2019, 3:32 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
0 |
|
2900 |
55478516 |
firiexp |
F |
June 12, 2019, 2:56 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
0 |
|
2900 |
55477717 |
newbiegcz |
F |
June 12, 2019, 2:06 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
0 |
|
2900 |
55716131 |
Richardluan |
F |
June 18, 2019, 12:48 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
30 |
0 |
|
2900 |
57753195 |
codgician |
F |
July 25, 2019, 3:25 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
0 |
|
2900 |
55716976 |
1751074774 |
F |
June 18, 2019, 1:12 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
0 |
|
2900 |
55574014 |
dantita |
F |
June 14, 2019, 9:18 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
0 |
|
2900 |
55514844 |
ILLLZKQF |
F |
June 13, 2019, 4:14 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
31 |
0 |
|
2900 |
55485115 |
Theo830 |
F |
June 12, 2019, 7:24 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
31 |
0 |
|
2900 |
55464547 |
RCG |
F |
June 11, 2019, 4:04 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
31 |
0 |
|
2900 |
62559305 |
forgottencsc |
F |
Oct. 14, 2019, 11:32 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
46 |
0 |
|
2900 |
56164679 |
JZmster |
F |
June 27, 2019, 1:48 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
62 |
0 |
|
2900 |
55457835 |
dreamoon_love_AA |
F |
June 11, 2019, 2:39 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
311 |
0 |
|
2900 |
55467092 |
Dukkha |
F |
June 11, 2019, 4:53 p.m. |
OK |
Java 8 |
TESTS |
42 |
2947 |
0 |
|
2900 |
56414281 |
lpm |
F |
July 2, 2019, 3:14 a.m. |
OK |
Java 8 |
TESTS |
43 |
2995 |
204800 |
|
2900 |
55950477 |
SpinDOS |
F |
June 23, 2019, 1:25 a.m. |
OK |
Mono C# |
TESTS |
43 |
841 |
204800 |
|
2900 |
55950487 |
SpinDOS |
F |
June 23, 2019, 1:25 a.m. |
OK |
Mono C# |
TESTS |
43 |
857 |
3584000 |
|
2900 |
55950508 |
SpinDOS |
F |
June 23, 2019, 1:27 a.m. |
OK |
Mono C# |
TESTS |
43 |
873 |
0 |
|
2900 |
55950642 |
SpinDOS |
F |
June 23, 2019, 1:39 a.m. |
OK |
Mono C# |
TESTS |
43 |
951 |
0 |
|
2900 |
66316035 |
EmK |
F |
Dec. 5, 2019, 1:07 p.m. |
OK |
Mono C# |
TESTS |
43 |
2152 |
11776000 |
|
2900 |
66316478 |
EmK |
F |
Dec. 5, 2019, 1:16 p.m. |
OK |
Mono C# |
TESTS |
43 |
2916 |
19148800 |
|
2900 |
55476751 |
youx |
F |
June 12, 2019, 12:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
2854 |
1228800 |
|
2900 |
remove filters
Back to search problems