백준 알고리즘/시뮬레이션43 백준 8958번 파이썬 num = int(input())for i in range(num): score=0 index=0 result = list(input()) while index< len(result): flag=0 sum=0 while (index 2018. 9. 18. 백준 1966번 파이썬 num = int(input())for i in range(num): c=[] count=0 M , N = map(int, input().split()) c = list(input().split()) ans=[0]*M ans[N] = 1 while (1): if c.index(max(c)) == 0: del c[0] count+=1 if ans[0] == 1: print(count) break else: del ans[0] else: c.append(c[0]) del c[0] ans.append(ans[0]) del ans[0] 2018. 9. 17. 백준 10845 파이썬 i = int(input())queue =[]for j in range(i): cmd = input().split() if cmd[0] == 'push': queue.append(cmd[1]) elif cmd[0] == 'pop': if len(queue) !=0: print(queue.pop(0)) else: print(-1) elif cmd[0] == 'size': print(len(queue)) elif cmd[0] == 'empty': if len(queue) == 0: print(1) else: print(0) elif cmd[0] == 'front': if len(queue) !=0: print(queue[0]) else: print(-1) elif cmd[0] == 'back': if len.. 2018. 9. 16. 백준 9012 파이썬 num = int(input())for i in range(num): vps = list(input()) while len(vps) != 0: if vps[0] == ')': print('NO') break else: if ')' in vps: vps.remove(')') vps.remove('(') else: print("NO") break if len(vps)==0: print("YES") 2018. 9. 16. 이전 1 ··· 7 8 9 10 11 다음