본문 바로가기

Python27

배열 연습 - 10871 ## 10871 x보다 작은 수n, x = input().split()n = int(n)x = int(x)a = input().split()a = map(int, a)lst = []for i in a: if i 2024. 6. 23. 17:53
배열 연습 - 10807 숫자 갯수를 제한해서 받는 문법은 검색했을 때 없는 걸로 나오는데..정확한 답인지 모르겠다 ## 10807 개수 세기n = input()lst = input().split()num = input()cnt = 0for i in lst: if num == i: cnt = cnt + 1print(cnt) 2024. 6. 23. 17:42
조건문 연습 - 2480 그렇게 맘에 들지는 않는 풀이.. 더 좋은 방법이 있을듯 하다## 2480 주사위 세개x, y, z = input().split()x = int(x)y = int(y)z = int(z)if x == y and y == z: ## 같은 눈 3개 나올 때 prize = x*1000 + 10000elif x == y or y == z or x == z: ## 같은 눈 2개 나올 때 lst = [] lst.append(x) lst.append(y) lst.append(z) cnt = {} for i in lst: if i in cnt : cnt[i] = cnt[i] + 1 cnt_fin = i else: cnt[i] = 1 prize = c.. 2024. 6. 21. 19:13
조건문 연습 - 2884 ## 2884 알람 시계h, m = input().split()h = int(h)m = int(m)if (h*60 + m) 2024. 6. 20. 22:40
조건문 연습 - 14691 ## 14691 사분면 고르기x = int(input())y = int(input())if x>0 and y>0 : print('1')elif x0: print('2')elif x 2024. 6. 20. 22:11
반복문 연습 - 2444 ## 2444 별찍기 - 7n = int(input())for i in range(1, 2*n): if i  백준에서 왜 틀렸다고 나오는지 모르겠다 2024. 6. 17. 23:22
반복문 연습 - 2439 ## 2438 별찍기n = int(input())for i in range(1, n+1): print('*' * i) 2024. 6. 11. 21:29
반복문 연습 - 25304 ## 25304 영수증x = int(input()) ## 총금액n = int(input()) ## 물건 종류tot = list()for i in range (1, n+1): a, b = input().split() a = int(a) b = int(b) tot_i = a*b tot.append(tot_i)if x == sum(tot): print('Yes')else: print('No') 2024. 6. 11. 21:12
반복문 연습 - 8393 ## 8393 합n = int(input())sum = 0for i in range(1, n+1): sum = i + sum i = i + 1print(sum) 2024. 6. 10. 21:01