Skip to content

Commit

Permalink
Solve Greyscale in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Jul 18, 2024
1 parent 06bf083 commit 61a0352
Show file tree
Hide file tree
Showing 6 changed files with 30,069 additions and 0 deletions.
17 changes: 17 additions & 0 deletions solutions/beecrowd/2630/2630.py
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)}')
13 changes: 13 additions & 0 deletions solutions/beecrowd/2630/generate_in.sh
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
Loading

0 comments on commit 61a0352

Please sign in to comment.