목록분류 전체보기 (317)
지나가던 개발자

while True: pages = [False for i in range(int(input()))] if len(pages) == 0: break toPrint = input().split(",") for i in toPrint: to_print = list(map(int, i.split("-"))) if to_print[0] > len(pages): continue if len(to_print) == 1: pages[to_print[0]-1] = True continue if to_print[0] > to_print[1]: continue if to_print[1] > len(pages): to_print[1] = len(pages) for j in range(to_print[0], to_print[..

from itertools import permutations def is_palindrome(a): return a == a[::-1] for i in range(int(input())): tango = [] for j in range(int(input())): tango.append(input()) printed = False for j in permutations(tango, 2): if is_palindrome("".join(j)): printed = True print("".join(j)) break if not printed: print(0) 메모리 초과가 떠도 그닥 이상치 않다고 생각하고 있었는데 맞았다.

print(len(input().replace("c=", "크").replace("c-", "로").replace("dz=", "아").replace("d-", "티").replace("lj", "아").replace("nj", "알").replace("s=", "파").replace("z=", "벳"))) 반복문을 사용해서 매우 귀찮게 구현할 수도 있다. i번째 요소와 i+1번째 요소를 비교해서 크로아티아 알파벳에 해당되면 i+1번째 요소를 지우고 length += 1을 해주는 뭐 그런 식으로 말이다. 그런데 이미 내장 함수 만드는 분들이 다 구현해 놓은 게 있는데 굳이 그렇게 해야 할까?

for i in range(int(input())): print("Class", i+1) classI = sorted(list(map(int, input().split()))[1:]) print("Max", str(max(classI)) + ", Min", min(classI), end=", ") largestGap = 0 for j in range(len(classI)-1): if classI[j+1] - classI[j] > largestGap: largestGap = classI[j+1] - classI[j] print("Largest gap", largestGap) 자꾸 틀렸습니다 떠서 "뭐지...?" 이러고 코드 살폈는데 맨 마지막 줄에 "Largest gap"을 "Largest Gap"이라고 ..

#include int main() { int n, x; int t[200]; scanf("%d %d", &n, &x); for (int i=0; i

import sys n, m = map(int,sys.stdin.readline().split()) array = [] for i in range(n): array.append(list(map(int,sys.stdin.readline().split()))) for i in range(int(input())): toSum = list(map(int,sys.stdin.readline().split())) s = 0 for j in range(toSum[0]-1, toSum[2]): for k in range(toSum[1]-1, toSum[3]): s += array[j][k] print(s) 시간초과 때문에 PyPy3로 제출해야 풀린다.

l = int(input()) if l % 5 == 0: print(l//5) else: print(l//5+1)

#include int main() { while (1) { char name[10]; int age, weight; scanf("%s %d %d", &name, &age, &weight); if ((age == 0) && (weight == 0)) { break; } if ((age > 17) || (weight >= 80)) { printf("%s Senior \n", name); continue; } printf("%s Junior \n", name); } return 0; } while (1)을 통해 무한 반복을 할 수 있다!