์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ/BOJ_Python

[BOJ/Step11] 7568 : ๋ฉ์น˜ (Python)

NaNaRin๐Ÿ™ƒ 2021. 2. 18. 18:09

www.acmicpc.net/problem/7568

 

7568๋ฒˆ: ๋ฉ์น˜

์šฐ๋ฆฌ๋Š” ์‚ฌ๋žŒ์˜ ๋ฉ์น˜๋ฅผ ํ‚ค์™€ ๋ชธ๋ฌด๊ฒŒ, ์ด ๋‘ ๊ฐœ์˜ ๊ฐ’์œผ๋กœ ํ‘œํ˜„ํ•˜์—ฌ ๊ทธ ๋“ฑ์ˆ˜๋ฅผ ๋งค๊ฒจ๋ณด๋ ค๊ณ  ํ•œ๋‹ค. ์–ด๋–ค ์‚ฌ๋žŒ์˜ ๋ชธ๋ฌด๊ฒŒ๊ฐ€ x kg์ด๊ณ  ํ‚ค๊ฐ€ y cm๋ผ๋ฉด ์ด ์‚ฌ๋žŒ์˜ ๋ฉ์น˜๋Š” (x, y)๋กœ ํ‘œ์‹œ๋œ๋‹ค. ๋‘ ์‚ฌ๋žŒ A ์™€ B์˜ ๋ฉ

www.acmicpc.net


ํ‚ค์™€ ๋ชธ๋ฌด๊ฒŒ๊ฐ€ ๋” ํด๋•Œ( > ) ๋ฉ์น˜์นด ๋” ํฌ๋‹ค ๋ผ๊ณ  ํ•œ๋‹ค. ๋ฉ์น˜ ๋“ฑ์ˆ˜๋Š” ์ž์‹ ๋ณด๋‹ค ๋” "ํฐ ๋ฉ์น˜"์˜ ์‚ฌ๋žŒ์˜ ์ˆ˜๋กœ ์ •ํ•ด์ง„๋‹ค

1. people ๋ฆฌ์ŠคํŠธ์— ๊ฐ ์‚ฌ๋žŒ์˜ ํ‚ค์™€ ๋ชธ๋ฌด๊ฒŒ๋ฅผ ๋ฆฌ์ŠคํŠธ๋กœ ์ถ”๊ฐ€

2. people ๋ฆฌ์ŠคํŠธ์—์„œ MyHeight(mh), MyWeight(mw), YourHeight(yh), YourWeight(yw) ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ  ๋น„๊ตํ•˜์—ฌ ๋ฉ์น˜๊ฐ€ ๋” ํด ๋•Œ count++ ( count๋Š” 1๋กœ ์ดˆ๊ธฐํ™”. ์ž์‹ ๋ณด๋‹ค ๋ฉ์น˜๊ฐ€ ํฐ ์‚ฌ๋žŒ์ด ์•„๋ฌด๋„ ์—†๋‹ค๋ฉด 1๋“ฑ )

3. count ๋ฅผ ์ถœ๋ ฅ

# 7568.py

n = int(input())
people = []
for i in range(n):
    people.append(list(map(int, input().split())))

for mh, mw in people:
    count = 1
    for yh, yw in people:
        if mh < yh and mw < yw:
            count += 1
    print(count, end=' ')