분류 전체보기439 백준 11866번 파이썬 a,b = map(int, input().split())list = [i for i in range(1,(a+1))]ans=[0]*aindex=0delete = b-1while (len(list)!=0): while delete >= len(list): delete = delete - len(list) ans[index] = list[delete] del list[delete] delete =delete + (b-1) index+=1 print("") else: print(ans[i],end=", ") 2018. 9. 17. 백준 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 ··· 99 100 101 102 103 104 105 ··· 110 다음