Skip to content

Commit 9620c28

Browse files
committed
Formatting & Unifying
1 parent 8be4b1c commit 9620c28

File tree

10 files changed

+197
-167
lines changed

10 files changed

+197
-167
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33

44
# Ignore Windows .ini files
55
*.ini
6+
7+
.vscode

Answers/MagicCircle.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
#include <algorithm>
99
#include <iostream>
10+
#include <random>
1011
using namespace std;
1112
#define il inline
12-
#define re register
1313
#define D double
1414

1515
il int read() {
16-
re int x = 0, f = 1;
17-
re char c = getchar();
16+
int x = 0, f = 1;
17+
char c = getchar();
1818
while (c < '0' || c > '9') {
1919
if (c == '-')
2020
f = -1;
@@ -27,7 +27,7 @@ il int read() {
2727
return x * f;
2828
}
2929

30-
#define rep(i, s, t) for (re int i = s; i <= t; ++i)
30+
#define rep(i, s, t) for (int i = s; i <= t; ++i)
3131
#define eps 1e-12
3232
#define maxn 100005
3333
#define ff(x) (x) * (x)
@@ -71,7 +71,9 @@ il void work() {
7171
int main() {
7272
n = read();
7373
rep(i, 1, n) scanf("%lf%lf", &e[i].x, &e[i].y);
74-
random_shuffle(e + 1, e + n + 1);
74+
std::random_device rd;
75+
std::mt19937 g(rd());
76+
std::shuffle(e + 1, e + n + 1, g);
7577
work();
7678
printf("%.10lf\n%.10lf %.10lf", r, o.x, o.y);
7779

Problems/AShowOffCat.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# A show-off cat
2+
3+
## Background and Problem description
4+
5+
The cat living next to DB, always a fan of shiny objects (Baling~ Baling~), has taken up a hobby of mining diamonds in her spare time! She has collected \( N \) diamonds of varying sizes, and she wants to arrange some of them in **a pair of** display cases in her cattery.
6+
7+
Since she wants the diamonds in each of the two cases to be relatively similar in size, she decides that she will not include two diamonds in the same case if their sizes differ by more than \( K \) (two diamonds can be displayed together in the same case if their sizes differ by exactly \( K \)). Given \( K \), please help her determine the maximum number of diamonds she can display in both cases together.
8+
9+
## Input format
10+
11+
The first line of the input file contains \( N \) and \( K \).
12+
13+
The next \( N \) lines each contain an integer giving the size of one of the
14+
15+
diamonds. All sizes will be positive and will not exceed $1,000,000,000$.
16+
17+
## Output format
18+
19+
Output a single positive integer, telling the maximum number of diamonds that
20+
21+
**She can showcase in total in both the cases.**
22+
23+
## Sample input and output
24+
25+
### Input
26+
27+
```in
28+
7 3
29+
10
30+
5
31+
1
32+
12
33+
9
34+
5
35+
14
36+
```
37+
38+
### Output
39+
40+
```out
41+
5
42+
```
43+
44+
## Constraints
45+
46+
For 100% of the test cases:
47+
48+
- \( N \leq 50,000 \)
49+
- \( 0 \leq K \leq 1,000,000,000 \)

Problems/A_show-off_cat.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

Problems/Gambling games.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

Problems/GamblingGames.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Gambling games
2+
3+
## Problem Description
4+
5+
As an OIer who loves gambling, you have received a rare ticket to enter the only profitable casino in the world. There are \( n \) prize pools in the casino, and the bonus of the \( i_{th} \) prize pool is \( a_i \). Each prize pool has a parameter \( b_i \) (\( 1 \le b_i \le n \))
6+
7+
The casino rules are as follows:,
8+
9+
At the beginning, players will be provided with a prize pool, and whenever they are given the \( i_{th} \) prize pool, they have two options:
10+
11+
1. Obtain the prize money from this prize pool.
12+
2. Skip the prize money in this pool, so they will never be able to receive the prize money in this pool.
13+
14+
Afterwards, the casino will offer players another prize pool based on the following rules
15+
16+
If the player selects prize pool \( i \), they will choose a prize pool within the range of \( j \le i \)
17+
18+
If the player skips prize pool \( i \), they will choose a prize pool within the range of \( j \le b_i \)
19+
20+
Among these prize pools, it will choose the one with the highest index, which has never been given to players before (players have neither selected nor skipped it before). If there is no such prize pool, then the player's gambling is over, and their prize money is equal to the total prize money of all the selected prize pools. Especially, if players choose the first prize pool, their gambling is over. Note that players can receive a maximum of one prize pool per game.
21+
22+
Now that you have arrived at this casino, please write a program to calculate the maximum bonus you can receive.
23+
24+
## Input format
25+
26+
Sure, let's translate the given problem constraints and details into LaTeX.
27+
28+
## Problem Statement in LaTeX
29+
30+
Each test consists of multiple test cases.
31+
32+
The first line contains an integer \( t \) — the number of test cases.
33+
34+
The description of the test cases is as follows:
35+
36+
- The first line of each test case contains an integer \( n \) — the number of prize pools.
37+
- The second line of each test case contains \( n \) integers \( a_1, a_2, \ldots, a_n \) — the prize money in the prize pool.
38+
- The third line of each test case contains \( n \) integers \( b_1, b_2, \ldots, b_n \) — the parameters of the prize pool.
39+
40+
## Output format
41+
42+
For each test case, output an integer, representing the highest score you can obtain.
43+
44+
## Sample input and output
45+
46+
### Input
47+
48+
```in
49+
4
50+
2
51+
15 16
52+
2 1
53+
5
54+
10 10 100 100 1000
55+
3 4 1 1 1
56+
3
57+
100 49 50
58+
3 2 2
59+
4
60+
100 200 300 1000
61+
2 3 4 1
62+
```
63+
64+
### Output
65+
66+
```out
67+
16
68+
200
69+
100
70+
1000
71+
```
72+
73+
## Constraints
74+
75+
For all test cases:
76+
77+
- \( 1 \leq t \leq 10^5 \)
78+
- \( 1 \leq n \leq 4 \cdot 10^5 \)
79+
- \( 1 \leq a_i \leq 10^9 \)

Problems/Let's make friends!.md renamed to Problems/MakeFriends.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Let's make friends ***!***
12

23
## Background and Problem description
34

@@ -7,13 +8,12 @@ To solve this problem, they found a dictionary to help them understand what the
78

89
## Input format
910

10-
The first line of input contains the message described in a certain language. This message will not contain more than **10<sup>6</sup>** characters. There will be exactly one whitespace between adjacent words, and the end of the line will be marked with \$. Characters after \$ will not be considered part of the message.
11+
The first line of input contains the message described in a certain language. This message will not contain more than \( 10^6 \) characters. There will be exactly one whitespace between adjacent words, and the end of the line will be marked with **\$**. Characters after **\$** will not be considered part of the message.
1112

12-
The following line contains the sentence described in another language, which we need to find in the first line. This sentence will also not be longer than **10<sup>6</sup>** characters and will follow the same format as described above.
13+
The following line contains the sentence described in another language, which we need to find in the first line. This sentence will also not be longer than \( 10^6 \) characters and will follow the same format as described above.
1314

1415
Except for the last character \$, all other characters are English letters and spaces.
1516

16-
1717
## Output format
1818

1919
Output the position where the sentence from the second line first appears in the message from the first line.
@@ -22,12 +22,15 @@ Output the position where the sentence from the second line first appears in the
2222
## Sample input and output
2323

2424
### Input
25-
```
25+
26+
```in
2627
miao meow meow woof hello $
2728
ga quack moo $
2829
```
30+
2931
### Output
30-
```
32+
33+
```out
3134
3
3235
```
3336

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
# Shortest path of the king
22

3-
## 题目描述
3+
## Background
44

5-
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square $ t $ . As the king is not in habit of wasting his time, he wants to get from his current position $ s $ to square $ t $ in the least number of moves. Help him to do this.
5+
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square \( t \) . As the king is not in habit of wasting his time, he wants to get from his current position \( s \) to square \( t \) in the least number of moves. Help him to do this.
66

7-
![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF3A/5ee13bc754378d9b20e7cf9389534f02014d55d0.png)
7+
![Chessboard](https://cdn.luogu.com.cn/upload/vjudge_pic/CF3A/5ee13bc754378d9b20e7cf9389534f02014d55d0.png)
88

99
In one move the king can get to the square that has a common side or a common vertex with the square the king is currently in (generally there are 8 different squares he can move to).
1010

1111
## 输入格式
1212

13-
The first line contains the chessboard coordinates of square $ s $ , the second line — of square $ t $ .
13+
The first line contains the chessboard coordinates of square \( s \) , the second line — of square \( t \) .
1414

1515
Chessboard coordinates consist of two characters, the first one is a lowercase Latin letter (from a to h), the second one is a digit from 1 to 8.
1616

1717
## 输出格式
1818

19-
In the first line print $ n $ — minimum number of the king's moves. Then in $ n $ lines print the moves themselves. Each move is described with one of the 8: L, R, U, D, LU, LD, RU or RD.
19+
In the first line print \( n \) — minimum number of the king's moves. Then in \( n \) lines print the moves themselves. Each move is described with one of the 8: L, R, U, D, LU, LD, RU or RD.
2020

2121
L, R, U, D stand respectively for moves left, right, up and down (according to the picture), and 2-letter combinations stand for diagonal moves. If the answer is not unique, print any of them.
2222

2323
## 样例 #1
2424

2525
### 样例输入 #1
2626

27-
```
27+
```in
2828
a8
2929
h1
3030
```
3131

3232
### 样例输出 #1
3333

34-
```
34+
```out
3535
7
3636
RD
3737
RD
@@ -40,4 +40,4 @@ RD
4040
RD
4141
RD
4242
RD
43-
```
43+
```

0 commit comments

Comments
 (0)