-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
ea7a538
commit 9b5406d
Showing
6 changed files
with
1,001 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,18 @@ | ||
import sys | ||
|
||
for line in sys.stdin: | ||
bet = set(map(int, line.split())) | ||
lottery_result = set(map(int, input().split())) | ||
|
||
numbers = len(bet & lottery_result) | ||
|
||
if numbers == 6: | ||
print('sena') | ||
elif numbers == 5: | ||
print('quina') | ||
elif numbers == 4: | ||
print('quadra') | ||
elif numbers == 3: | ||
print('terno') | ||
else: | ||
print('azar') |
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,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
TESTCASES=300 | ||
|
||
max_item=7 | ||
repeated_max_item=0 | ||
file_to_save_numbers=$(mktemp) | ||
|
||
function pick_number { | ||
picked_numbers_count=$(wc -l < "${file_to_save_numbers}") | ||
if [[ ${picked_numbers_count} -eq 6 ]] || [[ ${picked_numbers_count} -eq 0 ]]; then | ||
picked_number=$((RANDOM % max_item + 1)) | ||
echo "${picked_number}" > "${file_to_save_numbers}" | ||
else | ||
picked_number=$((RANDOM % max_item + 1)) | ||
while grep -Fxq "${picked_number}" "${file_to_save_numbers}"; do | ||
picked_number=$((RANDOM % max_item + 1)) | ||
done | ||
echo "${picked_number}" >> "${file_to_save_numbers}" | ||
|
||
fi | ||
echo "${picked_number}" | ||
} | ||
|
||
for _ in $(seq "${TESTCASES}"); do | ||
for _ in {1..5}; do | ||
picked_number=$(pick_number) | ||
echo -n "${picked_number} " | ||
done | ||
picked_number=$(pick_number) | ||
echo "${picked_number}" | ||
|
||
for _ in {1..5}; do | ||
picked_number=$(pick_number) | ||
echo -n "${picked_number} " | ||
done | ||
picked_number=$(pick_number) | ||
echo "${picked_number}" | ||
|
||
if [[ ${max_item} -lt 10 ]] && [[ ${repeated_max_item} -lt 5 ]]; then | ||
repeated_max_item=$((repeated_max_item + 1)) | ||
elif [[ ${max_item} -lt 10 ]] && [[ ${repeated_max_item} -eq 5 ]]; then | ||
repeated_max_item=0 | ||
max_item=$((max_item + 1)) | ||
elif [[ ${max_item} -gt 99 ]]; then | ||
max_item=99 | ||
else | ||
max_item=$((max_item + 1)) | ||
fi | ||
done |
Oops, something went wrong.