반응형
2739 구구단
a = int(input())
for i in range(1,10):
print("%d * %d = %d" %(a,i,a*i))
15552 빠른 A+B
import sys
n = int(input())
for i in range(n):
a,b = map(int,sys.stdin.readline().split())
print(a+b)
많은 입출력이 요구될 경우 sys.stdin.readline() 쓴다는 문제
11022 A+B-8
import sys
a = int(input())
for i in range(a):
x,y = map(int,sys.stdin.readline().split())
print("Case #%s: %s + %s = %d" %(i+1,x,y,x+y))
2439 별 찍기 -2
# 자바랑 헷갈려서 문자열 곱을 몰랐을 때
a = int(input())
for i in range(a-1,-1,-1):
for j in range(i):
print(" ",end="")
for l in range(a-i):
print("*",end="")
print()
# 문자열 곱을 알았을 때.. 간결하고 쉽다.
a = int(input())
for i in range(a):
print(" "*(a-i-1) + "*"*(i+1))
10871 X보다 작은 수
import sys
N,X = map(int,input().split())
a = list(map(int, sys.stdin.readline().split())) #복습겸 sys.stdin.readline()사용
for i in a:
if i < X:
print(i,end=" ")
10952 A+B -5
while True:
a,b = map(int,input().split())
if a==0 and b==0:
break
print(a+b)
1110 더하기 사이트
# 내가 짠 코드
initN = int(input())
n = initN
count = 0
while True:
b = n%10 #1의 자리
a = n//10 #10의 자리
sum = a+b
n = b*10+sum%10
count+=1
if initN==n : break
print(count)
# 다른 사람이 짠 코드
n = initN = int(input())
count = 0
while True:
b = n%10 #1의 자리
a = n//10 #10의 자리
sum = a + b
count += 1
n = int(str(n%10)+str(sum%10))
if (initN==n):
break
print(count)
반응형
'코딩테스트 > 백준 준비(과거)' 카테고리의 다른 글
(파이썬) 백준 1712, 1193, 2869, 10250, 2775, 2839, 1011 (0) | 2021.07.06 |
---|---|
(파이썬) 백준 11654, 11720, 10809, 2675, 1157, 1152, 2908, 5622, 2941, 1316 (0) | 2021.06.27 |
(파이썬) 백준 4673, 1065 (0) | 2021.06.26 |
(파이썬) 백준 10818, 2562, 2577, 3052, 1546, 8958, 4344 (0) | 2021.06.26 |
(파이썬) 백준 1330, 2753, 14681, 2884 (0) | 2021.06.24 |
댓글