간단한 369 게임

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

N = int(input())
result = []

for n in range(1, N+1):
    numStr = str(n)
    count = 0
    if numStr.find("3") > -1:
        count += numStr.count("3")
    if numStr.find("6") > -1:
        count += numStr.count("6")
    if numStr.find("9") > -1:
        count += numStr.count("9")

    if count == 0:
        result.append(str(n))
    else:
        result.append("-" * count)
print(' '.join(result))
728x90

파리 퇴치 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

T = int(input())

for t in range(1, T+1):
    N, M = map(int, input().split())
    arr = []
    # create map
    for n in range(N):
        arr.append(list(map(int, input().split())))
    result = []
    # 0 ~ N-1
    for i in range(N-M+1):
        for j in range(N-M+1):
            mSum = 0
            for mi in range(i, i+M):
                for mj in range(j, j+M):
                    mSum += arr[mi][mj]
            result.append(mSum)


    print(f"#{t} {max(result)}")
728x90
 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

 

swexpertacademy.com

 

자릿수 더하기

arr = list(input())
answer = 0
for i in range(len(arr)):
    answer += int(arr[i])
print(answer)

 

728x90
 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

 

swexpertacademy.com

 

서랍의 비밀번호

(a, b) = map(int, input().split(' '))
print(a-b+1)
728x90

+ Recent posts