728x90
5949번: Adding Commas
Bessie is working with large numbers N (1 <= N <= 2,000,000,000) like 153920529 and realizes that the numbers would be a lot easier to read with commas inserted every three digits (as is normally done in the USA; some countries prefer to use periods every
www.acmicpc.net
문제 풀이
이 문제는 파이썬으로 간단하게 해결할 수 있다. format 함수를 사용하면 1000 단위의 숫자에 콤마를 넣어줄 수 있다.
정답 코드
print(format(int(input()), ","))
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 6131 - 완전 제곱수 [python] (0) | 2023.03.16 |
---|---|
[BOJ/백준] 6030 - Scavenger Hunt [python] (0) | 2023.03.16 |
[BOJ/백준] 5789 - 한다 안한다 [python] (0) | 2023.03.16 |
[BOJ/백준] 5753 - Pascal Library [python] (0) | 2023.03.16 |
[BOJ/백준] 5691 - 평균 중앙값 문제 [python] (1) | 2023.03.15 |