BeakJoon/Python

[Python] 백준 #1271번 : 엄청난 부자2

쿼딩~ 2023. 11. 11. 22:29


걸림돌

  • 쉬운 알고리즘 문제였던 것 같다

코드


total, people = map(int,input().split())

mount = total//people;
remain_mount = total-(mount*people)

print(mount)
print(remain_mount)

`remain_mount = total - (mount*people)` 'remain_mount'에 'people'에게 나눠주고 남은 금액이 들어가야하기 때문에

총 금액인 'total'에서 인당 나눠주는 금액과 사람 수를 곱한 값을 빼면 되기 때문에 total - (mount*people) 의 값을 remain_total에 넣어준다.