공부, 기록

3752. 가능한 시험 점수 D4 파이썬 본문

코딩

3752. 가능한 시험 점수 D4 파이썬

무는빼주세요 2020. 8. 23. 13:24

문제링크 : https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWHPkqBqAEsDFAUn

 

 

SW Expert Academy

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

swexpertacademy.com

 

def solution(score):
    scoresum=set()
    scoresum.add(0)
    for i in score:
        scores=list()
        for j in scoresum:
            if i + j not in scoresum:
                scores.append(i+j)
        for i in scores:
            scoresum.add(i)
    return len(scoresum)
T = int(input())
# 여러개의 테스트 케이스가 주어지므로, 각각을 처리합니다.
for test_case in range(1, T + 1):
    count=int(input())
    if count ==0:
        print("#"+str(test_case),0)
    else:
        N=list(map(int,input().split()))
        print("#"+str(test_case),solution(N))