본문 바로가기

전체 글50

1206. [S/W 문제해결 기본] 1일차 - View for t in range(10): lenn = int(input()) lst = list(map(int,input().split())) ans = 0 for i in range(1,lenn-2): left1 = lst[i] - lst[i-2] left2 = lst[i] - lst[i-1] right1 = lst[i] - lst[i+1] right2 = lst[i] - lst[i+2] if left1 >= 0 and left2 >= 0 and right1 >=0 and right2 >=0: if left1 2019. 9. 17.
5642. [Professional] 합 t = int(input()) for q in range(t): n = int(input()) n_lst = list(map(int,input().split())) maxx = 0 hap = 0 for i in range(n): hap = hap + n_lst[i] if hap maxx: maxx = hap # hap이 maxx보다 크면 maxx는 hap print('#%d'%(q+1),maxx) 2019. 9. 15.
1204. [S/W 문제해결 기본] 1일차 - 최빈수 구하기 t = int(input()) for q in range(t): n = int(input()) lst = list(map(int,input().split())) lst_num = [0]*101 for i in range(1000): lst_num[lst[i]] += 1 maxx = max(lst_num) count = lst_num.count(maxx) while count !=1: count -= 1 a = lst_num.index(maxx) lst_num[a] = 0 ans = lst_num.index(maxx) print('#%d' % n,ans) 2019. 9. 15.
1288. 새로운 불면증 치료법 t = int(input()) for q in range(t): n = input() ncopy = n nlst = list(n) #n을 리스트에 저장 num = [''] * 10 # 0~9 까지 한번이라도 나오면 1로 표시 k = 1 # 실행횟수 ans = '' while num.count('1') != 10: k = k + 1 ans = int(ncopy) for i in range(len(ncopy)): num[int(nlst[i])] = '1' ncopy = str(int(n) * k) nlst = list(ncopy) print('#%d'%(q+1),ans) 2019. 9. 14.
1928. Base64 Decoder t = int(input()) Base64 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'] for p in range(t): strr = input() # 문자열 입력 ans = '' for q in range(0,len(strr),+4):#인코딩 문자 4개씩 집어넣기 four = strr[q].. 2019. 9. 14.
1940. 가랏! RC카! t = int(input()) for p in range(t): n = int(input()) #명령어 개수 speed = 0 m = 0 #이동거리 for i in range(n): #명령어, 가속도 입력받기 command_accel = list(map(int,input().split())) if command_accel[0] == 1: # 가속 speed = speed + command_accel[1] if command_accel[0] == 2: # 감속 if command_accel[1] > speed: speed = 0 #가속도가 속도보다 큰 경우 else: speed = speed - command_accel[1] # 속도가 가속도보다 크거나 같은 경우 m = m + speed print('#%.. 2019. 9. 14.