백준 알고리즘/구현85 백준 2490번 파이썬 lists = [0]*4for i in range(3): lists = list(map(int,input().split())) if lists.count(1) == 0: print('D') elif lists.count(1) == 1: print('C') elif lists.count(1) == 2: print('B') elif lists.count(1) == 3: print('A') elif lists.count(1) == 4: print('E') 2018. 9. 30. 백준 5430 파이썬 import sys for i in range(int(sys.stdin.readline())): cmd = list(sys.stdin.readline()) j = len(cmd) lens = int(sys.stdin.readline()) lists = list(sys.stdin.readline()[1:-1].split(',')) for cmds in cmd: try: if cmds == 'R': lists.reverse() elif cmds == 'D': del lists[0] lens -=1 except: sys.stdout.write('error\n') break for i in range(lens): if i==0: sys.stdout.write('[') if i != (lens-1): sys.st.. 2018. 9. 24. 백준 10866번 파이썬 num = int(input())a=[]for i in range(num): cmd = input().split() if cmd[0] == 'push_front': a.insert(0,cmd[1]) elif cmd[0] == 'push_back': a.append(cmd[1]) elif cmd[0] == 'pop_front': if len(a)!=0: print(a.pop(0)) else: print(-1) elif cmd[0] == 'pop_back': if len(a)!=0: print(a.pop(-1)) else: print(-1) elif cmd[0] == 'size': print(len(a)) elif cmd[0] == 'empty': if len(a) ==0: print(1) else: pri.. 2018. 9. 18. 백준 4948 파이썬 import mathnumber = [x for x in range(1,246913)]number.insert(0,1)for i in range(2,246913): j=2 while 246912>=i*j: number[i*j]=1 j+=1a=int(input())while a!=0: count=0 for i in range(a+1,2*a+1): if number[i]!=1: count += 1 print(count) a=int(input()) 2018. 9. 13. 이전 1 ··· 17 18 19 20 21 22 다음