https://www.acmicpc.net/problem/26332
26332번: Buying in Bulk
The first input line contains a positive integer, n, indicating the number of customers to check. The customers are on the following n input lines, one customer per line. Each line provides two integers; the first integer c (1 ≤ c ≤ 100) is the number
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
|
def sol(cnt, price):
if cnt>1:
return cnt*price-(cnt-1)*2
else:
return price
if __name__ == '__main__':
n = int(input())
for _ in range(n):
cnt, price = map(int, input().split())
print(cnt, price)
print(sol(cnt, price))
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 26736 Wynik meczu (0) | 2022.12.23 |
---|---|
백준 5358 Football Team (0) | 2022.12.22 |
백준 26531 Simple Sum (0) | 2022.12.22 |
백준 6825 Body Mass Index (0) | 2022.12.22 |
백준 26340 Fold the Paper Nicely (0) | 2022.12.22 |
댓글