백준 문제집 리스트 중 automata님의 Python 배우기 (1~50) 문제집의 풀이이다 (간단한 문제들은 설명이 없을 수 있음..)

https://www.acmicpc.net/workbook/view/459

 

문제집: Python 배우기 (1~50) (automata)

 

www.acmicpc.net

 

⭐️ 전에 푼거 아직 옮기는중..

 

2557 - Hello World

print('Hello World!')

 

1000 - A+B

a, b = map(int, input().split())

if 0 < a and b < 10:
    print(a + b)

 

10998 - A×B

a, b = map(int, input().split())

if 0 < a and b < 10:
    print(a*b)

 

1001 - A-B

a, b = map(int, input().split())

if 0 < a and b < 10:
    print(a - b)

 

1008 - A/B

a, b = map(int, input().split())

if 0 < a and b < 10:
    print(a / b)

 

10869 - 사칙연산

a, b = map(int, input().split())

if 1 <= a and b <= 10000:
    print(a + b)
    print(a - b)
    print(a * b)
    print(a // b)
    print(a % b)

 

10430 - 나머지

a, b, c = map(int, input().split())

if 2<=a<=100000 and 2<=b<=100000 and 2<=c<=100000:
    print((a+b)%c)
    print(((a%c)+(b%c))%c)
    print((a*b)%c)
    print(((a%c)*(b%c))%c)

 

2558 - A+B - 2

a = int(input())
b = int(input())
print(a + b)

 

2588 - 곱셈

fir = int(input())
sec = input()

print(fir * int(sec[2]))
print(fir * int(sec[1]))
print(fir * int(sec[0]))
print(fir * int(sec))

 

3046 - R2

R1, S = map(int, input().split())

R2 = S*2 - R1
print(R2)

 

2163 - 초콜릿 자르기

n, m = map(int, input().split())
choco = n*m
print(choco//1-1)

 

11021 - A+B - 7

t = int(input())

for i in range(t):
    a, b = map(int, input().split())
    if 0<a and b<10:
        print('Case #{}: {}' .format(i+1, a+b))

 

11022 - A+B - 8

t = int(input())

for i in range(t):
    a, b = map(int, input().split())
    if 0<a and b<10:
        print('Case #{}: {} + {} = {}'.format(i+1, a, b, a+b))

 

10699 - 오늘 날짜

print("2023-02-22")

 

7287 - 등록

71
t1mmyt1m

 

2525 - 오븐 시계

h, m = map(int, input().split())
c = int(input())

#if 0<=h<=23 and 0<=m<=59 and 0<=c<=1000:

a, b = (h+((m+c)//60), (m+c))
if b>59:
    print((h+((m+c)//60))%24, b%60)
elif b<59:
    print(a, b)
else:
    print(a, b%60)

 

2530 - 인공지능 시계

a, b, c = map(int, input().split())
i = int(input())

c += i%60
i = i//60
if c >= 60:
    c -= 60
    b += 1

b += i%60
i = i//60
if b >= 60:
    b -= 60
    a += 1

a += i%24
if a >= 24:
    a -= 24


print(a, b, c)

 

2914 - 저작권

a, j = map(int, input().split()) 
print(a * (j - 1) + 1)

 

5355 - 화성 수학

t = int(input())

for _ in range(t):
    n = list(map(str, input().split()))
    
    a = n[0]
    n.remove(a)
    a = float(a)

    for i in range(len(n)):

        if n[i] == '@':
            a *= 3
        elif n[i] == '%':
            a += 5
        elif n[i] == '#':
            a -= 7


    print("%0.2f"%a)

 

2675 - 문자열 반복

s = int(input())

for i in range(s):
    a , b = map(str, input().split())
    a = int(a)

    for j in range(len(b)):
        print(a*b[j], end='')
    print() #줄을 바꾸고 range(s)만큼 반복

 

2935 - 소음

a = int(input())
e = input()
b = int(input())

if e == '+':
    print(a + b)
elif e == '*':
    print(a * b)

 

9498 - 시험 성적

score = int(input())

if score >= 90:
    print("A")
elif 89>= score >= 80:
    print("B")
elif 79>= score >= 70:
    print("C")
elif 69>= score >= 60:
    print("D")
else:
    print("F")

 

10817 - 세 수

a = list(map(int, input().split()))

a.sort(reverse=False)
print(a[1])

 

11653 - 소인수분해

import math

n = int(input())
i = 2

while i <= math.sqrt(n):
    if n % i != 0:
        i += 1
    else:
        print(i)
        n //= i

if n > 1:
    print(n)

 

1789 - 수들의 합

s = int(input())
p = []
a = 1

while True:
    s -= a
    p.append(a)
    a += 1
    if s == 0:
        break
    elif s > 0:
        continue
    else:
        s += p[-1]
        if s in p:
            p.remove(s)
            s += s
            set(p) 
        break

print(len(p))

 

2753 - 윤년

a = int(input())

if 1<=a<=4000:
    if a%4==0 and a%100!=0 or a%400==0:
        print(1)
    else:
        print(0)

 

10039 - 평균 점수

a = []

for _ in range(5):
    a.append(int(input()))

for i in range(5):
    if a[i] < 40:
        a[i] = 40

print(sum(a) // 5)

 

1934 - 최소공배수

import math

def lcm(a, b):
    return a * b // math.gcd(a, b)

line = int(input())

for i in range(line):
    x, y = map(int, input().split())
    print(lcm(x, y))

 

2480 - 주사위 세개

t1, t2, t3 = list(map(int, input().split()))

if t1==t2==t3:
    print(10000 + t1*1000)
elif t1==t2 or t2==t3:
    print(1000 + t2*100)
elif t3==t1:
    print(1000 + t3*100)
else:
    print(max(t1, t2, t3)*100)

 

4101 - 크냐?

while True:
    a, b = list(map(int, input().split()))
    if a > b:
        print("Yes")
    elif a == 0 and b == 0: #
        break
    elif a < b or a == b:
        print("No")

 

10156 - 과자

k, n, m = map(int, input().split())

if k*n <= m:
    print(0)
else:
    print(k*n-m)

 

3009 - 네 번째 점

x, y = [], []

for i in range(3):
    a, b = map(int, input().split())
    x.append(a)
    y.append(b)


i = 0

if x[i] == x[i+1]:
    c = x[i+2]
elif x[i] == x[i+2]:
    c = x[i+1]
elif x[i+1] == x[i+2]:
    c = x[i]
else:
    c = x[i]

if y[i] == y[i+1]:
    d = y[i+2]
elif y[i] == y[i+2]:
    d = y[i+1]
elif y[i+1] == y[i+2]:
    d = y[i]
else:
    d = y[i]

print(c, d)

 

2476 - 주사위 게임

a = int(input())
b = []

for i in range(1, a+1):
    nums = list(map(int, input().split()))
    dup = {x for x in nums if nums.count(x) == 2}
    eup = {x for x in nums if nums.count(x) == 3}
    # 위 코드는 중복되는 숫자를 리스트에 추가하는 코드

    #if nums.count(x) > 1:
    #    for x in nums:
    #        dup.append(x)
    if dup:
        c = 1000+dup.pop()*100 #dup.pop()을 해주는 이유는 set에 있는 숫자인 중복되는 수를 int로 꺼내서 연산하기 위함
        #그냥 dup로 하면 TypeError: unsupported operand type(s) for *: 'set' and 'int' 에러뜸
    elif eup:
        c = 10000+eup.pop()*1000
    else:
        c = max(nums)*100
    b.append(c)

print(max(b))

 

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B

1000 - A+B