쏘ing
[Python] CLASS 1 - B2 본문
[백준 1152] 단어의 개수
https://www.acmicpc.net/problem/1152
풀이
word = input().split()
print(len(word))
[백준 2562] 최댓값
https://www.acmicpc.net/problem/2562
풀이
num_list = []
for _ in range (9):
num_list.append(int(input()))
print(max(num_list))
print(num_list.index(max(num_list))+1)
[백준 2577] 숫자의 개수
https://www.acmicpc.net/problem/2577
풀이
sum = 1
for _ in range (3):
sum *= int(input())
res = str(sum)
for i in range(10):
print(res.count(str(i)))
[백준 2675] 문자열 반복
https://www.acmicpc.net/problem/2675
풀이
num = int(input())
for _ in range(num):
count, word = input().split()
res = ''
for i in range(len(word)):
res += (word[i] * int(count))
print(res)
[백준 2908] 상수
https://www.acmicpc.net/problem/2908
풀이
a, b = input().split()
new_a = int(a[::-1])
new_b = int(b[::-1])
if new_a > new_b:
print(new_a)
else:
print(new_b)
[백준 2920] 음계
https://www.acmicpc.net/problem/2920
풀이
num = list(map(int, input().split()))
if num == sorted(num):
print('ascending')
elif num == sorted(num, reverse = True):
print('descending')
else:
print('mixed')
[백준 3052] 나머지
https://www.acmicpc.net/problem/3052
풀이
rest = []
for i in range (10):
num = int(input())
rest.append(num % 42)
print(len(set(rest)))
[백준 8958] OX 퀴즈
https://www.acmicpc.net/problem/8958
풀이
num = int(input())
for _ in range (num):
count = 0
score = 0
quiz = input()
for i in range (len(quiz)):
if quiz[i] == 'O':
count += 1
score += count
else:
count = 0
print(score)
[백준 10809] 알파벳 찾기
https://www.acmicpc.net/problem/10809
풀이
word_list = 'abcdefghijklmnopqrstuvwxyz'
word = input()
for i in word_list:
if i in word:
print(word.index(i), end = " ")
else:
print(-1, end = " ")
[백준 11720] 숫자의 합
https://www.acmicpc.net/problem/11720
풀이
num = int(input())
num_list = input()
sum = 0
for i in range (num):
sum += int(num_list[i])
print(sum)
'알고리즘 > CLASS 1' 카테고리의 다른 글
[Python] CLASS 1 - B3 (0) | 2022.02.08 |
---|---|
[Python] CLASS 1 - B4 (0) | 2022.02.08 |
[Python] CLASS 1 - B5 (0) | 2022.02.08 |
Comments