본문 바로가기
python-algorithm

백준 3512 Flat

by 무적김두칠 2022. 12. 31.

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

 

3512번: Flat

You are one of the developers of software for a real estate agency. One of the functions you are to implement is calculating different kinds of statistics for flats the agency is selling. Each flat consists of different types of rooms: bedroom, bathroom, k

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if __name__ == '__main__':
    n, c = map(int,input().split())
    area_rooms = 0
    area_bedrooms = 0
    area_balcony = 0
    for _ in range(n):
        ai, ti = input().split()
        area_rooms += int(ai)
        if ti == 'bedroom':
            area_bedrooms += int(ai)
        if ti == 'balcony':
            area_balcony += int(ai)
    cost_flat = (area_rooms-(area_balcony/2))*c
    print(area_rooms)
    print(area_bedrooms)
    print(cost_flat)
 
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 24267 알고리즘 수업 - 알고리즘의 수행 시간 6  (0) 2023.01.03
백준 11328 Strfry  (0) 2023.01.02
백준 26264 빅데이터? 정보보호!  (0) 2022.12.30
백준 26004 HI-ARC  (0) 2022.12.28
백준 10698 Ahmed Aly  (0) 2022.12.28

댓글