[Baekjoon] Solved.ac Class 1回答


1000. A+B [B5]
A, B = map(int,input().split())
print(A+B)
1001. A-B [B5]
A, B = map(int,input().split())
print(A-B)
1008. A/B [B4]
A, B = map(int,input().split())
print(A/B)
1152.単語数[B 2]
length = len(input().split())   # list에 나누어 넣어준다.
print(length)
1330.単語学習
length = len(input().split())   # list에 나누어 넣어준다.
print(length)
1330.2つの数字を比較する[B 4]
A, B = map(int,input().split())

if A < B:
    print('<')
elif A > B:
    print('>')
else: print('==')
2438.星図-1[B 3]
N = int(input())

for i in range(1, N+1):
    print('*'*i)
2439.星図-2[B 3]
N = int(input())

for i in range(1, N+1):
    string = '*'*i
    print(f'{string:>{N}}')
2475.検証数[B 5]
nums = map(int,input().split())
sum = 0
for i in nums:
    sum += i**2
print(sum % 10)
2753.閏年[B 4]
year = int(input())

if (year % 4 == 0) and ((year % 100) or (year % 400 == 0)):
    print(1)
else: print(0)
9498.試験成績[B 4]
score = int(input())

if score >= 90:
    print('A')
elif score >= 80:
    print('B')
elif score >= 70:
    print('C')
elif score >= 60:
    print('D')
else: print('F')
10171.ネコ[B 5]
print('\\    /\\')
print(" )  ( ')")
print('(  /  )')
print(' \(__)|')
10172.個[B 5]
print('|\_/|')
print('|q p|   /}')
print('( 0 )"""\\')
print('|"^"`    |')
print('||_/=\\\__|')
10869.四則演算[B 5]
A, B = map(int,input().split())
print(A+B)
print(A-B)
print(A*B)
print(A//B)
print(A%B)
10998. AxB [B5]
A, B = map(int,input().split())
print(A*B)
11654.アスキーコード[B 5]
print(ord(input()))
10950. A+B - 3 [B3]
for _ in range(int(input())):
    print(sum(map(int, input().split())))
10952. A+B - 5 [B3]
while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    print(a + b)
2562.最低価格[B 2]
arr = [0] + [int(input()) for _ in range(9)]
max_cnt = 0
for i in range(1, 10):
    if arr[i] > arr[max_cnt]:
        max_cnt = i
print(arr[max_cnt], max_cnt)
2675.繰り返し文字列[B 2]
import sys
input = sys.stdin.readline	# 입력이 많아 readline으로 바꿔준다.

t = int(input().rstrip())
for _ in range(t):
    n, string = input().split()
    n = int(n)
    result = ''
    for c in string:		# string을 순회하며 글자 하나씩 가져온다.
        result += c * n		# string 연산자를 활용해 글자를 곱해서 더해준다.
    print(result)
2739.九九九九九九九[B 3]
n = int(input())
for i in range(1, 10):
    print(f'{n} * {i} = {n * i}')
2920.音階[B 2]
arr = list(map(int, input().split()))
asc = [i + 1 for i in range(8)]	# 1부터 8까지 순서대로
desc = asc[::-1]	# 슬라이싱으로 뒤집어준다.
if arr == asc:
    print('ascending')
elif arr == desc:
    print('descending')
else:
    print('mixed')
8958.OXテスト[B 2]
t = int(input())
for _ in range(t):
    arr = list(input())
    cnt = 0
    result = 0
    for ox in arr:
        if ox == 'O':
            cnt += 1	# O가 나오면 cnt += 1
            result += cnt	# result에 cnt를 더한다.
        else:	# X가 나오면 cnt 초기화
            cnt = 0
    print(result)
10818.最小最大[B 3]
n = int(input())
arr = list(map(int, input().split()))
small = arr[0]
big = arr[0]
for num in arr:
    if num > big:
        big = num
    elif num < small:
        small = num
print(small, big)
11720.数字の和[B 2]
n = int(input())
arr = list(map(int, input()))
print(sum(arr))