728x90
문제
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 three digits). Thus, she would like to add commas: 153,920,529. Please write a program that does this.
입력
- Line 1: A single integer: N
출력
- Line 1: The integer N with commas inserted before each set of three digits except the first digits (as traditionally done in many cultures)
풀이
입력받은 수를 읽기 쉽도록 3자리마다 쉼표를 넣어 출력해주는 문제다.
format함수를 사용해 쉽게 풀이할 수 있다.
소스코드
출처
728x90
'PS > Baekjoon Online Judge' 카테고리의 다른 글
[백준 05988] 홀수일까 짝수일까 [Python] (1) | 2024.07.12 |
---|---|
[백준 11383] 뚊 [Python] (0) | 2024.07.11 |
[백준 03996] 위대한 사기꾼 [Python] (1) | 2024.07.10 |
[백준 05789] 한다 안한다 [Python] (0) | 2024.07.09 |
[백준 06798] Knight Hop [Java] (0) | 2024.07.07 |