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"Tarly has two different type of items, food boxes and wine barrels. There are f food boxes and w wine barrels. Tarly stores them in various stacks and each stack can consist of either food boxes or wine barrels but not both. The stacks are placed in a line such that no two stacks of food boxes are together and no two stacks of wine barrels are together. The height of a stack is defined as the number of items in the stack. Two stacks are considered different if either their heights are different or one of them contains food and other contains wine. Jon Snow doesn't like an arrangement if any stack of wine barrels has height less than or equal to h. What is the probability that Jon Snow will like the arrangement if all arrangement are equiprobably? Two arrangement of stacks are considered different if exists such i, that i-th stack of one arrangement is different from the i-th stack of the other arrangement. The first line of input contains three integers f, w, h (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89f, xe2 x80 x89w, xe2 x80 x89h xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- number of food boxes, number of wine barrels and h is as described above. It is guaranteed that he has at least one food box or at least one wine barrel. Output the probability that Jon Snow will like the arrangement. The probability is of the form , then you need to output a single integer p xc2 xb7q xe2 x80 x89- xe2 x80 x891 mod (109 xe2 x80 x89+ xe2 x80 x897). In the first example f xe2 x80 x89 xe2 x80 x89= xe2 x80 x89 xe2 x80 x891, w xe2 x80 x89= xe2 x80 x891 and h xe2 x80 x89= xe2 x80 x891, there are only two possible arrangement of stacks and Jon Snow doesn't like any of them. In the second example f xe2 x80 x89= xe2 x80 x891, w xe2 x80 x89= xe2 x80 x892 and h xe2 x80 x89= xe2 x80 x891, there are three arrangements. Jon Snow likes the (1) and (3) arrangement. So the probabilty is . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
24951947 |
xzyxzy |
F |
Feb. 24, 2017, 1:46 a.m. |
OK |
GNU C++ |
TESTS |
72 |
15 |
5324800 |
|
2300 |
24951608 |
xzyxzy |
F |
Feb. 24, 2017, 1:23 a.m. |
OK |
GNU C++ |
TESTS |
72 |
15 |
5324800 |
|
2300 |
24951576 |
xzyxzy |
F |
Feb. 24, 2017, 1:20 a.m. |
OK |
GNU C++ |
TESTS |
72 |
15 |
5324800 |
|
2300 |
26918997 |
vjudge5 |
F |
May 7, 2017, 8:17 a.m. |
OK |
GNU C++ |
TESTS |
72 |
30 |
819200 |
|
2300 |
26918975 |
vjudge4 |
F |
May 7, 2017, 8:15 a.m. |
OK |
GNU C++ |
TESTS |
72 |
30 |
819200 |
|
2300 |
30238834 |
zx2003 |
F |
Sept. 10, 2017, 6:22 a.m. |
OK |
GNU C++ |
TESTS |
72 |
30 |
1228800 |
|
2300 |
27049342 |
Tz_rain |
F |
May 12, 2017, 7:51 a.m. |
OK |
GNU C++ |
TESTS |
72 |
30 |
2457600 |
|
2300 |
24902247 |
wumaodang |
F |
Feb. 22, 2017, 9:04 p.m. |
OK |
GNU C++ |
TESTS |
72 |
30 |
3481600 |
|
2300 |
26921560 |
Chenhongkan |
F |
May 7, 2017, 10:52 a.m. |
OK |
GNU C++ |
TESTS |
72 |
31 |
819200 |
|
2300 |
27282247 |
jiyutian |
F |
May 22, 2017, 11 a.m. |
OK |
GNU C++ |
TESTS |
72 |
31 |
1433600 |
|
2300 |
56627490 |
rainboy |
F |
July 6, 2019, 2:40 p.m. |
OK |
GNU C11 |
TESTS |
72 |
46 |
2048000 |
|
2300 |
24856257 |
mirecek3 |
F |
Feb. 20, 2017, 9:56 p.m. |
OK |
GNU C11 |
TESTS |
72 |
733 |
2662400 |
|
2300 |
24853746 |
quailty |
F |
Feb. 20, 2017, 8:25 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
15 |
3686400 |
|
2300 |
32768552 |
wfj_2048 |
F |
Nov. 29, 2017, 6:54 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
15 |
4608000 |
|
2300 |
31940902 |
permui |
F |
Nov. 1, 2017, 7:18 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
1228800 |
|
2300 |
25007220 |
ditoly |
F |
Feb. 25, 2017, 8:43 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
2662400 |
|
2300 |
24855264 |
Chameleon2460 |
F |
Feb. 20, 2017, 9:05 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
2867200 |
|
2300 |
28131401 |
AkaneSasu |
F |
June 29, 2017, 4:35 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
3481600 |
|
2300 |
24873758 |
bciobanu |
F |
Feb. 21, 2017, 2:32 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
3481600 |
|
2300 |
25457005 |
mlz000 |
F |
March 13, 2017, 3:24 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
4505600 |
|
2300 |
24870685 |
PlayfulPanda |
F |
Feb. 21, 2017, 12:18 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
30 |
5324800 |
|
2300 |
57876971 |
lopare |
F |
July 28, 2019, 5:56 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
31 |
614400 |
|
2300 |
33042546 |
Flash-boy |
F |
Dec. 9, 2017, 7:31 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
15 |
2662400 |
|
2300 |
25427496 |
dklsfjlksdfj |
F |
March 12, 2017, 8:15 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
15 |
3481600 |
|
2300 |
33409516 |
nickpros |
F |
Dec. 19, 2017, 1:32 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
30 |
3584000 |
|
2300 |
24891638 |
Stronger2020 |
F |
Feb. 22, 2017, 11:44 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
30 |
3584000 |
|
2300 |
29207214 |
Vtysvt |
F |
Aug. 5, 2017, 2:20 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
30 |
5120000 |
|
2300 |
31730504 |
McGinn |
F |
Oct. 26, 2017, 6:51 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
31 |
819200 |
|
2300 |
26919593 |
KyleYoung |
F |
May 7, 2017, 8:48 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
31 |
819200 |
|
2300 |
26917962 |
vjudge1 |
F |
May 7, 2017, 7:17 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
31 |
819200 |
|
2300 |
42029484 |
Kepperoni |
F |
Aug. 24, 2018, 2:44 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
31 |
819200 |
|
2300 |
43904925 |
vjudge1 |
F |
Oct. 6, 2018, 1:44 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
31 |
1638400 |
|
2300 |
48887753 |
vjudge5 |
F |
Jan. 24, 2019, 12:57 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
31 |
2764800 |
|
2300 |
46297897 |
m1sch3f |
F |
Nov. 28, 2018, 5:08 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
31 |
3174400 |
|
2300 |
61710962 |
Umi |
F |
Oct. 2, 2019, 11:25 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
31 |
3276800 |
|
2300 |
48886389 |
vjudge5 |
F |
Jan. 24, 2019, 12:28 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
46 |
2764800 |
|
2300 |
54407152 |
thenymphsofdelphi |
F |
May 20, 2019, 7:08 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
46 |
3174400 |
|
2300 |
59583861 |
yizhibaiwuya |
F |
Aug. 27, 2019, 5:09 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
46 |
3174400 |
|
2300 |
54407452 |
dmmm123 |
F |
May 20, 2019, 7:22 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
46 |
3584000 |
|
2300 |
41273447 |
zck Kananix |
F |
Aug. 6, 2018, 11:54 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
46 |
4812800 |
|
2300 |
60046685 |
mmello |
F |
Sept. 4, 2019, 8:50 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
61 |
1638400 |
|
2300 |
46549512 |
brimix__ |
F |
Dec. 3, 2018, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
62 |
7270400 |
|
2300 |
24852098 |
gchebanov |
F |
Feb. 20, 2017, 6:43 p.m. |
OK |
Go |
TESTS |
72 |
46 |
24883200 |
|
2300 |
24850142 |
uwi |
F |
Feb. 20, 2017, 6:30 p.m. |
OK |
Java 8 |
TESTS |
72 |
140 |
20582400 |
|
2300 |
25010410 |
IgorKoval |
F |
Feb. 25, 2017, 11:10 a.m. |
OK |
Java 8 |
TESTS |
72 |
156 |
20582400 |
|
2300 |
56627489 |
Dukkha |
F |
July 6, 2019, 2:40 p.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
0 |
|
2300 |
24854479 |
Lewin |
F |
Feb. 20, 2017, 8:38 p.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
20684800 |
|
2300 |
33588515 |
MazzForces |
F |
Dec. 24, 2017, 8:57 a.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
20684800 |
|
2300 |
24853919 |
fetetriste |
F |
Feb. 20, 2017, 8:27 p.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
20684800 |
|
2300 |
25095227 |
donli |
F |
Feb. 28, 2017, 7:54 a.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
45056000 |
|
2300 |
25093651 |
donli |
F |
Feb. 28, 2017, 6:06 a.m. |
OK |
Java 8 |
TESTS |
72 |
202 |
45056000 |
|
2300 |
48205261 |
bwang1008 |
F |
Jan. 11, 2019, 8:23 a.m. |
OK |
Java 8 |
TESTS |
72 |
405 |
0 |
|
2300 |
24851788 |
pitfall |
F |
Feb. 20, 2017, 6:41 p.m. |
OK |
Java 8 |
TESTS |
72 |
436 |
20582400 |
|
2300 |
25073092 |
Asgar |
F |
Feb. 27, 2017, 9:39 a.m. |
OK |
MS C# |
TESTS |
72 |
124 |
9523200 |
|
2300 |
48888266 |
vjudge3 |
F |
Jan. 24, 2019, 1:07 p.m. |
OK |
MS C++ |
TESTS |
72 |
46 |
2560000 |
|
2300 |
24913102 |
TonySnark |
F |
Feb. 23, 2017, 9:33 a.m. |
OK |
MS C++ |
TESTS |
72 |
93 |
2867200 |
|
2300 |
24908644 |
lucyanna2018 |
F |
Feb. 23, 2017, 5:13 a.m. |
OK |
MS C++ |
TESTS |
72 |
187 |
3891200 |
|
2300 |
24853828 |
Filyan |
F |
Feb. 20, 2017, 8:26 p.m. |
OK |
MS C++ |
TESTS |
72 |
218 |
3686400 |
|
2300 |
24847923 |
Auster |
F |
Feb. 20, 2017, 6:06 p.m. |
OK |
MS C++ |
TESTS |
72 |
280 |
6246400 |
|
2300 |
24866358 |
ruhan.habib39 |
F |
Feb. 21, 2017, 9:02 a.m. |
OK |
PyPy 3 |
TESTS |
72 |
639 |
45465600 |
|
2300 |
24870458 |
PlayfulPanda |
F |
Feb. 21, 2017, 12:08 p.m. |
OK |
Python 2 |
TESTS |
72 |
358 |
16281600 |
|
2300 |
remove filters
Back to search problems