Development Project

[ Baekjoon - 단계별로 풀어보기(05/26) ] - 3단계 : 반복문 본문

CodingTest/Baekjoon

[ Baekjoon - 단계별로 풀어보기(05/26) ] - 3단계 : 반복문

나를 위한 시간 2022. 5. 26. 22:36
  • 2739 : 구구단
num = int(input())
for i in range(1,10):
    print(num,"*",i,"=",num*i)
#
n = int(input())
for i in range(1, 10):
    print(f'{n} * {i} = {n * i}')

 

  • 10950 : A+B-3
a = int(input())
for i in range(a):
    b, c = map(int, input().split(' '))
    print(b + c)

 

  • 8983 :  합
num = int(input())
result=0
for i in range(num+1):
    result+=i
print(result)

 

  • 15552 : 빠른 A+B
import sys
if __name__ == '__main__':
    T = int(sys.stdin.readline().rstrip())
    for _ in range(T):
        A, B = map(int, sys.stdin.readline().rstrip().split())
        print(A+B)
#
import sys
t = int(input())
for i in range(t):
    a, b = map(int, sys.stdin.readline().split())
    print(a+b)

 

  • 2741 : N 찍기
num = int(input())
for i in range(1, num+1):
    print(i)
#
N = int(input())
assert N <= 100000

for i in range(N):
  print(i+1)

 

  • 2742 : 기찍 N
num=int(input())
for i in range(num):
    print(num-i)
#
num = int(input())
for i in range(num,0,-1):
    print(i)

 

  • 11021 : A+B-7
num = int(input())
for i in range(num):
    a,b = map(int, input().split())
    print(f"Case #{i+1}: {a+b}")

 

  • 11022 : A+B-8
num = int(input())
for i in range(num):
    a,b=map(int, input().split())
    print(f"Case #{i+1}: {a} + {b} = {a+b}")

 

  • 2438 : 별 찍기 - 1
for i in range(1,int(input())+1):
    print("*"*i)

 

  • 2439 : 별 찍기 - 2
num = int(input())
for i in range(1,num+1):
    print(" "*(num-i)+"*"*i)

 

  • 10871 : X보다 작은 수
a,b = map(int, input().split())
num_list = list(map(int, input().split()))
for i in range(a):
    if b>num_list[i]:
        print(num_list[i], end=" ")

 

  • 10952 : A+B-5
while True:
    a,b = map(int, input().split())
    if a==0 and b==0:
        break
    print(a+b)

 

  • 10951 : A+B-4
while True:
    try:
        A,B = map(int, input().split())
        print(A + B)
    except EOFError:
        break

 

  • 1110 : 더하기 사이클
num = int(input())
res = num
ok = 0
cnt = 0
while num!=res or ok==0:
    cnt+=1
    res = res%10*10 + (res%10+res//10)%10
    ok+=1 if res==num else 0
print(cnt)

 

Comments