본문 바로가기

TIL/Algorithm

[백준] 코딩연습

반응형

2588. 곱셈

import math
a = input()
b = input()

sum = 0
for index, i in enumerate(b[::-1]):
    sum += math.pow(10, index) * (int(a) * int(i))
    print(int(a) * int(i))

print(int(sum))

3046. R2

a, b = input().split()
print(2*int(b) - int(a))

2163. 초콜릿 자르기

a, b = input().split()
print((int(a)*int(b))-1)

11021. A+B -7

n = input()
answer = []
for i in range(int(n)):
    a, b = input().split()
    answer.append(int(a)+int(b))

for index, i in enumerate(answer):
    print(f"Case #{index+1}: {i}")

11022. A+B - 8

n = input()
answer = []
list_a = []
list_b = []
for i in range(int(n)):
    a, b = input().split()
    answer.append(int(a)+int(b))
    list_a.append(int(a))
    list_b.append(int(b))

for index, i in enumerate(answer):
    print(f"Case #{index+1}: {list_a[index]} + {list_b[index]} = {i}")

10699. 오늘 날짜

from datetime import datetime
print(datetime.strftime(datetime.now(), "%Y-%m-%d"))

2525. 오븐 시계

hour, minutes = input().split()
takes = input()

sum_min = int(minutes) + int(takes)
pass_value = sum_min // 60
spare_time = sum_min % 60

# print(pass_value, spare_time)

hour = (int(hour) + pass_value) % 24
print(hour, spare_time)
반응형