문제출처 :백준 python 50
14번 화성수학
case = int(input())
for i in range(case):
math = list(map(str,input().split()))
result = 0
for j in range(len(math)):
if j == 0:
result += float(math[j])
else:
if math[j] == "@":
result *= 3
elif math[j] == "%":
result += 5
elif math[j] == "#":
result -= 7
print("%0.2f" % result)
3
10 @ #
23.00
10 20 2
10.00
20 30 @
60.00
15번 문자열 반복
n = int(input())
for i in range(n):
cnt, word = input().split()
for j in word:
print(j*int(cnt), end='')
print()
3
3 abc
aaabbbccc
2 /HTP
//HHTTPP
4 adlafjksd
aaaaddddllllaaaaffffjjjjkkkkssssdddd
16번 소음
a = int(input())
b = input()
c = int(input())
if b == "*":
print(a*c)
else:
print(a+c)
1000
*
10
10000
17번 소음
s = int(input())
if s >= 90:
print("A")
elif s >= 80:
print("B")
elif s >= 70:
print("C")
elif s >= 60:
print("D")
else:
print("F")
100
A
18번 세 수 중 두번째로 큰 수
n = map(int, input().split())
a = sorted(n)
print(a[1])
30 20 50
20
19번 소인수분해
n = int(input())
if n == 1:
print('')
for i in range(2, n+1):
while n % i == 0:
print(i)
n = n / i
100
2
2
5
5
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
55
20번 수들의 합
s = int(input())
n = 1
while n*(n+1)/2 <= s:
n += 1
print(n-1)
200
19
21번 윤년
a = int(input())
if (a % 4 == 0 and a % 100 != 0) or a % 400 == 0:
print(1)
else:
print(0)
1999
0
22번 평균점수
sum = 0
for i in range(5):
x = int(input())
if x < 40:
sum += 40
else:
sum += x
print(int(sum/5))
23번 최소공배수
num = int(input())
for i in range(num):
a, b = map(int, input().split())
A, B = a, b
while a!=0:
b = b%a
a,b = b,a
lcm = A*B //b
print(lcm)
3
1 45000
45000
6 10
30
13 17
221
24번 주사위 세개
a, b, c = map(int, input().split())
if a == b == c:
print(10000 + a*1000)
elif a==b or a==c:
print(1000 + a * 100)
elif b==c:
print(1000 + b * 100)
else:
print(100 * max(a,b,c))
2 2 2
12000