-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0483d45
commit 7f55977
Showing
6 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys | ||
|
||
for line in sys.stdin: | ||
j, r = map(int, line.split()) | ||
players_scores = dict(zip(range(1, j + 1), [0] * j)) | ||
winner_player = 1 | ||
winner_player_points = 0 | ||
|
||
for points_index, points in enumerate(map(int, input().split())): | ||
player_index = points_index % j + 1 | ||
players_scores[player_index] += points | ||
|
||
if players_scores[player_index] >= winner_player_points: | ||
winner_player_points = players_scores[player_index] | ||
winner_player = player_index | ||
|
||
print(winner_player) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
TESTCASES=90 | ||
MAX_J=500 | ||
MAX_R=500 | ||
MAX_VICTORY_POINTS=100 | ||
|
||
for _ in $(seq "${TESTCASES}"); do | ||
j="$((RANDOM % MAX_J + 1))" | ||
r="$((RANDOM % MAX_R + 1))" | ||
echo "${j} ${r}" | ||
|
||
for i in $(seq "$((j * r))"); do | ||
if [[ ${i} -ne 1 ]]; then | ||
echo -n " " | ||
fi | ||
echo -n "$((RANDOM % MAX_VICTORY_POINTS))" | ||
done | ||
echo | ||
done |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
226 | ||
42 | ||
40 | ||
324 | ||
372 | ||
103 | ||
35 | ||
21 | ||
2 | ||
214 | ||
74 | ||
154 | ||
80 | ||
198 | ||
330 | ||
5 | ||
127 | ||
173 | ||
42 | ||
102 | ||
4 | ||
16 | ||
86 | ||
213 | ||
135 | ||
32 | ||
21 | ||
208 | ||
229 | ||
10 | ||
185 | ||
175 | ||
56 | ||
22 | ||
179 | ||
4 | ||
100 | ||
90 | ||
94 | ||
74 | ||
60 | ||
55 | ||
113 | ||
139 | ||
61 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
https://judge.beecrowd.com/en/problems/view/1940 | ||
|
||
# Strategy Game | ||
|
||
A strategy game, with J players, is played around a table. The first player is | ||
the player 1, the second to play is the player 2, and so on. Once completed one | ||
round, again the first player makes his move and the order of the players is | ||
repeated again. Every move, a player guarantees a certain amount of Victory | ||
Points. The score of each player is the sum of Victory Points each of your | ||
moves. | ||
|
||
Given the number of players, the number of rounds and a list representing | ||
Victory Points in the order they were obtained, you must determine what the | ||
winning player. If more than one player get the highest score, the player with | ||
the highest score that you played last is the winner. | ||
|
||
## Input | ||
|
||
The input consists of two lines. The first line contains two integers $J$ and | ||
$R$, the number of players and rounds respectively $(1 \leq J, R \leq 500)$. The | ||
second line contains integer $J \times R$ corresponding to Victory Points in | ||
each of the moves made in the order they happened. The Victory Points obtained | ||
in each round will always be integers between 0 and 100, inclusive. | ||
|
||
## Output | ||
|
||
Your program should produce a single line containing the integer corresponding | ||
to the winning player. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ad-hoc |