-
-
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
06bf083
commit 61a0352
Showing
6 changed files
with
30,069 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 @@ | ||
t = int(input()) | ||
|
||
for t_index in range(1, t + 1): | ||
conversion_type = input() | ||
rgb = list(map(int, input().split())) | ||
|
||
if conversion_type == 'min': | ||
print(f'Caso #{t_index}: {min(rgb)}') | ||
elif conversion_type == 'mean': | ||
print(f'Caso #{t_index}: {int(sum(rgb) / 3)}') | ||
elif conversion_type == 'eye': | ||
r = rgb[0] * 0.3 | ||
g = rgb[1] * 0.59 | ||
b = rgb[2] * 0.11 | ||
print(f'Caso #{t_index}: {int(r + g + b)}') | ||
else: | ||
print(f'Caso #{t_index}: {max(rgb)}') |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
TEST_CASES=10000 | ||
CONVERSIONS=("eye" "mean" "max" "min") | ||
|
||
echo "${TEST_CASES}" | ||
|
||
for _ in $(seq "${TEST_CASES}"); do | ||
echo "${CONVERSIONS[$((RANDOM % 4))]}" | ||
echo "$((RANDOM % 256)) $((RANDOM % 256)) $((RANDOM % 256))" | ||
done |
Oops, something went wrong.