728x90

별로 어렵지 않게 풀었다. 시간 초과도 나지 않았다.

 

 

 
import sys
 
 
 
a = int(sys.stdin.readline())
 
 
for i in range(0,a):
 
    k = [ ]
    count = 0
 
    num = int(sys.stdin.readline())
 
    for j in range(1,10000):
        if len(k)==10:          
 
            break
        else:
            m = list(str(num*j))
            count+=1
            for z in range(0,len(m)):
                if m[z] not in k:
                    k.append(m[z])
                    if len(k)==10:
                        print("Case #"+str(i+1)+": "+ str(num*j))
                        break
 
    if len(k)!=10:
        print("Case #"+str(i+1)+": "+"INSOMNIA")
728x90

+ Recent posts