From 450595ccbd20fef792539ead8965250140a0f2ea Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 27 Sep 2024 15:57:45 -0300 Subject: [PATCH] Solve Hour for a Run in python --- solutions/beecrowd/2968/2968.py | 17 +++++++++++ solutions/beecrowd/2968/generate_in.sh | 17 +++++++++++ solutions/beecrowd/2968/in.txt | 39 ++++++++++++++++++++++++++ solutions/beecrowd/2968/out.txt | 39 ++++++++++++++++++++++++++ solutions/beecrowd/2968/problem.md | 29 +++++++++++++++++++ solutions/beecrowd/2968/tags.txt | 1 + 6 files changed, 142 insertions(+) create mode 100644 solutions/beecrowd/2968/2968.py create mode 100755 solutions/beecrowd/2968/generate_in.sh create mode 100644 solutions/beecrowd/2968/in.txt create mode 100644 solutions/beecrowd/2968/out.txt create mode 100644 solutions/beecrowd/2968/problem.md create mode 100644 solutions/beecrowd/2968/tags.txt diff --git a/solutions/beecrowd/2968/2968.py b/solutions/beecrowd/2968/2968.py new file mode 100644 index 00000000..2b5c8752 --- /dev/null +++ b/solutions/beecrowd/2968/2968.py @@ -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() diff --git a/solutions/beecrowd/2968/generate_in.sh b/solutions/beecrowd/2968/generate_in.sh new file mode 100755 index 00000000..423e5645 --- /dev/null +++ b/solutions/beecrowd/2968/generate_in.sh @@ -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 diff --git a/solutions/beecrowd/2968/in.txt b/solutions/beecrowd/2968/in.txt new file mode 100644 index 00000000..bea1ab5e --- /dev/null +++ b/solutions/beecrowd/2968/in.txt @@ -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 diff --git a/solutions/beecrowd/2968/out.txt b/solutions/beecrowd/2968/out.txt new file mode 100644 index 00000000..a894f499 --- /dev/null +++ b/solutions/beecrowd/2968/out.txt @@ -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 diff --git a/solutions/beecrowd/2968/problem.md b/solutions/beecrowd/2968/problem.md new file mode 100644 index 00000000..4bd41a2e --- /dev/null +++ b/solutions/beecrowd/2968/problem.md @@ -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. diff --git a/solutions/beecrowd/2968/tags.txt b/solutions/beecrowd/2968/tags.txt new file mode 100644 index 00000000..ae224c24 --- /dev/null +++ b/solutions/beecrowd/2968/tags.txt @@ -0,0 +1 @@ +beginner