백준 스터디 1주차

이재윤·2022년 11월 12일

백준

목록 보기
1/4

1. 셀프 넘버

def d(n):
    value = n
    while n > 0 :
        value += n % 10
        n = n//10
    return value
nums = list(range(1,10001))

for i in range(1,10000):
    if d(i)<=10000 :
        nums[d(i)-1] = 0

for i in nums:
    if i != 0:
        print(i)

2. 소수 찾기

n = int(input())
cnt = n
nums = list(map(int,input().split()))
for i in nums:
    if i == 1:
        n -= 1
    else:
        for j in range(2,i):
            if i % j == 0:
                n -= 1
                break
print(n)

3. 그룹 단어 체커

n = int(input())
cnt = n
for i in range(n):
    word = input()
    letter = list()
    for j in range(len(word)):
        if j == 0:
            letter.append(word[j])
            continue
        if word[j] == word[j-1]:
            continue
        else:
            if word[j] in letter:
                n -= 1
                break
            else:
                letter.append(word[j])
print(n)

4. 크로아티아 알파벳

ca= ["c=","c-","dz=","d-","lj","nj","s=","z="]

word = input()
for i in ca :
    if i in word:
        word = word.replace(i,"*")
> print(len(word))
profile
하지만 중요한 건 꺾이지 않는 마음 #코드업100제 #백준

0개의 댓글