https://www.acmicpc.net/problem/3060
3060번: 욕심쟁이 돼지
입력은 T개의 테스트 데이터로 구성된다. 입력의 첫 번째 줄에는 입력 데이터의 수를 나타내는 정수 T가 주어진다. 각 테스트 데이터는 두 줄로 구성되어 있고, 첫째 줄에는 하루에 배달되는 사
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
def sol(food, pigs):
total_sum =sum(pigs)
days = 1
while food>=total_sum:
total_sum+=total_sum*3
days+=1
return days
if __name__ == '__main__':
n=int(input())
for i in range(n):
food = int(input())
pigs = list(map(int, input().split()))
print(sol(food,pigs))
|
cs |
양 옆과 맞은편을 더한다는 말은 결국 총 합의 3배가 된다는 뜻이죵
Adding the sides and the opposite side means that the total sum is three times
반응형
'python-algorithm' 카테고리의 다른 글
백준 25828 Corona Virus Testing (0) | 2022.11.30 |
---|---|
백준 17903 Counting Clauses (0) | 2022.11.30 |
백준 25915 연세여 사랑한다 (0) | 2022.11.30 |
백준 15372 A Simple Problem. (0) | 2022.11.30 |
백준 13623 Zero or One (0) | 2022.11.30 |
댓글