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"Your friend recently gave you some slimes for your birthday. You have a very large amount of slimes with value 1 and 2, and you decide to invent a game using these slimes. You initialize a row with n empty spaces. You also choose a number p to be used in the game. Then, you will perform the following steps while the last space is empty. You have played the game a few times, but have gotten bored of it. You are now wondering, what is the expected sum of all values of the slimes on the board after you finish the game. The first line of the input will contain two integers n, xe2 x80 x89p (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109, xe2 x80 x891 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89p xe2 x80 x89< xe2 x80 x89109). Print the expected sum of all slimes on the board after the game finishes. Your answer will be considered correct if its absolute or relative error does not exceed 10 xe2 x80 x89- xe2 x80 x894. Namely, let's assume that your answer is a and the answer of the jury is b. The checker program will consider your answer correct, if . In the first sample, we have a board with two squares, and there is a 0.5 probability of a 1 appearing and a 0.5 probability of a 2 appearing. Our final board states can be 1 2 with probability 0.25, 2 1 with probability 0.375, 3 2 with probability 0.1875, 3 1 with probability 0.1875. The expected value is thus (1 xe2 x80 x89+ xe2 x80 x892) xc2 xb70.25 xe2 x80 x89+ xe2 x80 x89(2 xe2 x80 x89+ xe2 x80 x891) xc2 xb70.375 xe2 x80 x89+ xe2 x80 x89(3 xe2 x80 x89+ xe2 x80 x892) xc2 xb70.1875 xe2 x80 x89+ xe2 x80 x89(3 xe2 x80 x89+ xe2 x80 x891) xc2 xb70.1875 xe2 x80 x89= xe2 x80 x893.5625."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
16190075 |
Philipsweng |
G |
Feb. 19, 2016, 1:49 a.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
0 |
|
3300 |
15754527 |
130705009 |
G |
Feb. 2, 2016, 4:49 p.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
0 |
|
3300 |
16405916 |
aufeas |
G |
Feb. 28, 2016, 3:49 p.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
102400 |
|
3300 |
26352632 |
tlzmybm |
G |
April 14, 2017, 8:29 a.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
2048000 |
|
3300 |
28425629 |
progg_admin |
G |
July 11, 2017, 12:02 p.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
2150400 |
|
3300 |
30457418 |
vjudge1 |
G |
Sept. 18, 2017, 7:24 a.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
3788800 |
|
3300 |
25969823 |
zhan8855 |
G |
March 31, 2017, 7:02 a.m. |
OK |
GNU C++ |
TESTS |
110 |
15 |
5836800 |
|
3300 |
15820425 |
jinzhao |
G |
Feb. 5, 2016, 7:31 a.m. |
OK |
GNU C++ |
TESTS |
110 |
30 |
0 |
|
3300 |
26041359 |
Jin_Haonan |
G |
April 1, 2017, 3:16 a.m. |
OK |
GNU C++ |
TESTS |
110 |
30 |
2252800 |
|
3300 |
40985308 |
ReaLNero1 |
G |
July 30, 2018, 7:52 p.m. |
OK |
GNU C++ |
TESTS |
110 |
31 |
0 |
|
3300 |
15748516 |
wraith7 |
G |
Feb. 2, 2016, 11:08 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
15 |
0 |
|
3300 |
15748568 |
wraith7 |
G |
Feb. 2, 2016, 11:11 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
30 |
0 |
|
3300 |
16292571 |
jkxing |
G |
Feb. 23, 2016, 12:54 p.m. |
OK |
GNU C++11 |
TESTS |
110 |
30 |
204800 |
|
3300 |
15768969 |
noxwell |
G |
Feb. 3, 2016, 1:10 p.m. |
OK |
GNU C++11 |
TESTS |
110 |
30 |
204800 |
|
3300 |
15744136 |
matthew99 |
G |
Feb. 2, 2016, 5:45 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
30 |
1331200 |
|
3300 |
19435239 |
fsps60312 |
G |
July 27, 2016, 7:02 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
31 |
0 |
|
3300 |
55739897 |
luogu_bot3 |
G |
June 19, 2019, 6:51 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
31 |
102400 |
|
3300 |
55739831 |
207M |
G |
June 19, 2019, 6:49 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
31 |
102400 |
|
3300 |
59352383 |
hk_cnyali |
G |
Aug. 23, 2019, 12:17 p.m. |
OK |
GNU C++11 |
TESTS |
110 |
31 |
204800 |
|
3300 |
51470600 |
WaterPen |
G |
March 19, 2019, 6:13 a.m. |
OK |
GNU C++11 |
TESTS |
110 |
31 |
204800 |
|
3300 |
44535915 |
Misaka19090 |
G |
Oct. 19, 2018, 8:54 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
204800 |
|
3300 |
39203419 |
XingGeRuCi |
G |
June 13, 2018, 12:44 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
204800 |
|
3300 |
23465959 |
Ali.Pi |
G |
Dec. 31, 2016, 8:33 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
1945600 |
|
3300 |
36295020 |
CQzhangyu |
G |
March 15, 2018, 9:58 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
2048000 |
|
3300 |
35875613 |
cyz666 |
G |
March 3, 2018, 8:24 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
3072000 |
|
3300 |
49617720 |
black_horse2014 |
G |
Feb. 8, 2019, 7:16 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
31 |
21401600 |
|
3300 |
39203326 |
XingGeRuCi |
G |
June 13, 2018, 12:35 a.m. |
OK |
GNU C++14 |
TESTS |
110 |
46 |
204800 |
|
3300 |
50930637 |
langsike |
G |
March 7, 2019, 1:48 p.m. |
OK |
GNU C++14 |
TESTS |
110 |
265 |
1024000 |
|
3300 |
30245096 |
NiroBC |
G |
Sept. 10, 2017, 12:34 p.m. |
OK |
GNU C++14 |
TESTS |
110 |
608 |
102400 |
|
3300 |
69814397 |
gongsuidashen |
G |
Jan. 30, 2020, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
110 |
31 |
1740800 |
|
3300 |
69284212 |
ruo |
G |
Jan. 22, 2020, 7:24 a.m. |
OK |
GNU C++17 |
TESTS |
110 |
46 |
512000 |
|
3300 |
57954758 |
Benq |
G |
July 29, 2019, 6:08 p.m. |
OK |
GNU C++17 |
TESTS |
110 |
46 |
12390400 |
|
3300 |
15983087 |
Eagle_Owl |
G |
Feb. 13, 2016, 7:26 a.m. |
OK |
Java 8 |
TESTS |
110 |
155 |
0 |
|
3300 |
15685343 |
SimpleToo |
G |
Jan. 30, 2016, 8:26 p.m. |
OK |
Java 8 |
TESTS |
110 |
155 |
0 |
|
3300 |
15677995 |
Horrible |
G |
Jan. 30, 2016, 12:12 p.m. |
OK |
Java 8 |
TESTS |
110 |
155 |
0 |
|
3300 |
15669560 |
Lewin |
G |
Jan. 29, 2016, 11:48 p.m. |
OK |
Java 8 |
TESTS |
110 |
155 |
0 |
|
3300 |
15669558 |
Lewin |
G |
Jan. 29, 2016, 11:48 p.m. |
OK |
Java 8 |
TESTS |
110 |
155 |
0 |
|
3300 |
16299570 |
JShinjuro |
G |
Feb. 23, 2016, 8:26 p.m. |
OK |
Java 8 |
TESTS |
110 |
171 |
0 |
|
3300 |
15725489 |
WORLD_OF_TANKS |
G |
Feb. 1, 2016, 6:11 a.m. |
OK |
Java 8 |
TESTS |
110 |
171 |
0 |
|
3300 |
remove filters
Back to search problems