Skip to content

Commit

Permalink
Solve Hello Galaxy in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Sep 24, 2024
1 parent 7f55977 commit 9e6e8f5
Show file tree
Hide file tree
Showing 6 changed files with 52,832 additions and 0 deletions.
18 changes: 18 additions & 0 deletions solutions/beecrowd/1515/1515.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
n = int(input())
while not n == 0:
sent_first = float('inf')
first_sender_planet = ''
for _ in range(n):
planet, received_at, travel_time = input().split()
received_at = int(received_at)
travel_time = int(travel_time)

sent_at = received_at - travel_time

if sent_at < sent_first:
sent_first = sent_at
first_sender_planet = planet

print(first_sender_planet)

n = int(input())
25 changes: 25 additions & 0 deletions solutions/beecrowd/1515/generate_in.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -euo pipefail

TESTCASES=1000
MAX_N=100
MAX_T=1000
MAX_PLANET_NAME_SUFFIX_SIZE=13
LETTERS=(a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)

function planet_name {
echo -n "Planeta"
for _ in $(seq "${MAX_PLANET_NAME_SUFFIX_SIZE}"); do
echo -n "${LETTERS[$((RANDOM % 52))]}"
done
}

for _ in $(seq "${TESTCASES}"); do
n=$((RANDOM % MAX_N + 1))
echo "${n}"
for _ in $(seq "${n}"); do
echo "$(planet_name) $((RANDOM % 99 + 2014)) $((RANDOM % MAX_T + 1))"
done
done
echo "0"
Loading

0 comments on commit 9e6e8f5

Please sign in to comment.