python-algorithm

백준 26332 Buying in Bulk

무적김두칠 2022. 12. 22. 16:44

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
반응형