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

test_data = [] for i in range(int(input())): test_data.append(list(map(int, input().split()))) for i in range(len(test_data)): test_data[i] = [x for x in test_data[i] if x%2==0] print(sum(test_data[i]), min(test_data[i]))

people = list(map(int, input().split())) people = people[0] * people[1] newspapers = list(map(int, input().split())) for a in newspapers: print(a - people) P㎡인 공간에서 1㎡ 당 사람이 L 명 왔으니 전체 온 사람 수는 P*L 명이 된다.

n = int(input()) hihi = [] while True: a = int(input()) if a == 0: break hihi.append(a) for hi in hihi: if hi % n == 0: print(str(hi) + " is a multiple of " + str(n) + ".") continue print(str(hi) + " is NOT a multiple of " + str(n) + ".")

day = input() cars = input().split() print(cars.count(day)) 리스트에서 특정 요소의 개수를 구하는 법은 저번에 다뤘었다. https://developer-next-to-you.tistory.com/33 [Python] 리스트에서 특정 요소 개수 구하기 살다 보면, 가끔 리스트에서 특정 요소의 개수를 구하는 것이 필요할 때도 있고 하다. examples = [1, 1, 0, 0, 1, 0, 1] zeros = 0 for example in examples: if example == 0: zeros += 1 이렇게 코드를 작.. developer-next-to-you.tistory.com

a, b, c = list(map(int, input().split())) hihi = int(a*b/c) haha = int(a/b*c) if hihi > haha: print(hihi) else: print(haha) 곱하기나 나누기가 들어갈 수 있는 공간은 2개뿐이니 a*b/c와 a/b*c를 계산한 값 중 큰 값을 출력하면 된다.

import math n, k = list(map(int, input().split())) print(int(math.comb(n, k)%10007)) 저번 11050번(이항 계수 1) 문제의 코드에서 약간만 수정했다.

음... 나는 중학생이라 이항 계수가 뭔지 잘 모른다. 조합론에서, 이항 계수(二項係數, 영어: binomial coefficient)는 이항식을 이항 정리로 전개했을 때 각 항의 계수이며,주어진 크기의 (순서 없는) 조합의 가짓수이다. 위키백과의 이항 계수 문서를 인용했다. 근데 뭔말인지 잘 모르겠어서 모듈을 써야겠다 생각하고 구글링을 좀 해봤다. 고등학생이나 대학생 되면 알게 될 걸 굳이 지금 기본기도 안잡혀있는데 알 필요는... https://www.delftstack.com/ko/howto/python/calculate-binomial-coefficient-python/ Python의 이항 계수 이 튜토리얼에서는 이항 계수와 Python에서 이를 계산하는 방법을 보여줍니다. www.delftsta..

abc = [] for i in range(3): abc.append(int(input())) abc = list(str(abc[0]*abc[1]*abc[2])) for i in range(10): print(abc.count(str(i))) 리스트에서 특정 요소를 세는 법은 저번에 포스팅했었다. 숏코딩들을 둘러보다가 다른 사람의 코드도 하나 발견했는데, 가장 기억에 남는 코드를 하나 올려볼까 한다. import math A = input() A = int(A) B = input() B = int(B) C = input() C = int(C) D = A * B * C if D > 9999999: if D > 99999999: D1 = D%10 D2 = math.floor(D/10)%10 D3 = math..