Skip to content

Commit

Permalink
Solve Hour for a Run in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Sep 27, 2024
1 parent 4b1f308 commit 450595c
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 0 deletions.
17 changes: 17 additions & 0 deletions solutions/beecrowd/2968/2968.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys
import math

for line in sys.stdin:
v, n = map(int, line.split())

step = 10
for i in range(10, 100, 10):
step = v * n / 100 * i

if abs(float(int(step)) - step) < 1e-9:
print(int(step), end="")
else:
print(math.ceil(step), end="")
if i <= 80:
print(end=" ")
print()
17 changes: 17 additions & 0 deletions solutions/beecrowd/2968/generate_in.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -euo pipefail

TESTCASES=100

max_v=10
max_n=10

echo "1 1"
for i in $(seq "${TESTCASES}"); do
echo "$((RANDOM % max_v + 1)) $((RANDOM % max_n + 1))"
if [[ $((i % 10)) -eq 0 ]] && [[ ${max_v} -le 10000 ]]; then
max_v=$((max_v * 10))
max_n=$((max_n * 10))
fi
done
39 changes: 39 additions & 0 deletions solutions/beecrowd/2968/in.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
1 1
9 4
5 6
1 3
6 3
7 1
5 4
4 9
3 2
7 1
3 4
73 54
95 14
31 99
4 50
45 86
67 34
62 79
72 50
83 100
97 28
789 400
608 205
110 140
808 862
37 779
57 923
580 766
118 891
56 477
974 553
2430 219
7297 3778
126 7670
7748 4885
8211 9805
7527 7201
8594 2854
3590 9379
39 changes: 39 additions & 0 deletions solutions/beecrowd/2968/out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
1 1 1 1 1 1 1 1 1
4 8 11 15 18 22 26 29 33
3 6 9 12 15 18 21 24 27
1 1 1 2 2 2 3 3 3
2 4 6 8 9 11 13 15 17
1 2 3 3 4 5 5 6 7
2 4 6 8 10 12 14 16 18
4 8 11 15 18 22 26 29 33
1 2 2 3 3 4 5 5 6
1 2 3 3 4 5 5 6 7
2 3 4 5 6 8 9 10 11
395 789 1183 1577 1971 2366 2760 3154 3548
133 266 399 532 665 798 931 1064 1197
307 614 921 1228 1535 1842 2149 2456 2763
20 40 60 80 100 120 140 160 180
387 774 1161 1548 1935 2322 2709 3096 3483
228 456 684 912 1139 1367 1595 1823 2051
490 980 1470 1960 2449 2939 3429 3919 4409
360 720 1080 1440 1800 2160 2520 2880 3240
830 1660 2490 3320 4150 4980 5810 6640 7470
272 544 815 1087 1358 1630 1902 2173 2445
31560 63120 94680 126240 157800 189360 220920 252480 284040
12464 24928 37392 49856 62320 74784 87248 99712 112176
1540 3080 4620 6160 7700 9240 10780 12320 13860
69650 139300 208949 278599 348248 417898 487548 557197 626847
2883 5765 8647 11530 14412 17294 20177 23059 25941
5262 10523 15784 21045 26306 31567 36828 42089 47350
44428 88856 133284 177712 222140 266568 310996 355424 399852
10514 21028 31542 42056 52569 63083 73597 84111 94625
2672 5343 8014 10685 13356 16028 18699 21370 24041
53863 107725 161587 215449 269311 323174 377036 430898 484760
53217 106434 159651 212868 266085 319302 372519 425736 478953
2756807 5513614 8270420 11027227 13784033 16540840 19297647 22054453 24811260
96642 193284 289926 386568 483210 579852 676494 773136 869778
3784898 7569796 11354694 15139592 18924490 22709388 26494286 30279184 34064082
8050886 16101771 24152657 32203542 40254428 48305313 56356199 64407084 72457970
5420193 10840386 16260579 21680771 27100964 32521157 37941349 43361542 48781735
2452728 4905456 7358183 9810911 12263638 14716366 17169094 19621821 22074549
3367061 6734122 10101183 13468244 16835305 20202366 23569427 26936488 30303549
29 changes: 29 additions & 0 deletions solutions/beecrowd/2968/problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
https://judge.beecrowd.com/en/problems/view/2968

# Hour for a Run

Vinicius takes his fitness very seriously, and every morning at 6 a.m., rain or
shine, in summer and winter, he runs in a track around a pond. Along the race
track there are $N$ equally spaced signs. To not be discouraged from exercising,
Vinicius counts the number of signs he has passed and checks to see if he has
run at least 10%, at least 20%, ... , at least 90% of his training.

Let’s help Vinicius by calculating for him the number of signs he needs to count
to have completed at least 10%, 20%, ... , 90% of his training, given the number
of laps he wants to run and the total number of signs along the track

For example, suppose Vinicius wants to run 3 laps and the track has 17 signs. To
ensure that he has run at least 30% of his training, he needs to count 16 signs.
To guarantee at least 60%, he needs to count 31 signs.

## Input

The input consists of a single line, which contains two integers, $V$ and $N (1
\leq V, N \leq 10^4 )$, where V is the desired number of laps and $N$ is the
number of signs along the track.

## Output

Your program must output a single line, containing nine integers, representing
the numbers of signs that must be counted to ensure that at least 10%, 20%, ...
, 90% of the training has been completed, respectively.
1 change: 1 addition & 0 deletions solutions/beecrowd/2968/tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
beginner

0 comments on commit 450595c

Please sign in to comment.