백준 알고리즘/시뮬레이션43 백준 1874 파이썬 i= int(input())a=[]b=[]index=1for i in range(i): num = int(input()) if (index==1) or (len(a)==1) or (len(a)==0) or (a[-1] 2018. 9. 14. 백준 10828 파이썬 n = int(input())a=[]for i in range(n): cmd = input().split() if cmd[0] == 'push': a.append(cmd[1]) elif cmd[0] == 'pop': try:print(a.pop()) except: print(-1) elif cmd[0] == 'size': print(len(a)) elif cmd[0] == 'empty': if len(a)==0: print(1) else: print(0) elif cmd[0] == 'top': try: print(a[-1]) except: print(-1) 2018. 9. 13. 백준 9020 파이썬 number = [x for x in range(1,10001)]number.insert(0,1)for i in range(2,10001): j=2 while 10000>=i*j: number[i*j]=1 j+=1n = int(input())for i in range(n): a = int(input()) div = a//2 p = div q=div while p>0: if number[p] !=1 and number[q]!=1: if number[p] + number[q] == a: print(number[p], number[q]) break p-=1 q+=1 2018. 9. 13. 이전 1 ··· 8 9 10 11 다음