본문 바로가기
python-algorithm

백준 24087 アイスクリーム (Ice Cream)

by 무적김두칠 2024. 4. 18.

https://www.acmicpc.net/problem/24087

 

24087번: アイスクリーム (Ice Cream)

JOI アイスクリーム店は,非常に高さのあるアイスクリームタワーが名物のアイスクリーム店である.アイスクリームタワーとは,ベースとなるアイスクリームの上に,追加のアイスクリーム

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from math import ceil
 
 
def sol(s, a, b):
    answer = 250
    cost = 100
    if s <= a:
        return answer
    else:
        cnt = ceil((s - a) / b)
        return answer + cnt * cost
 
 
if __name__ == '__main__':
    s = int(input())
    a = int(input())
    b = int(input())
    print(sol(s, a, b))
 
cs
반응형

댓글