結果

問題 No.784 「,(カンマ)」
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-12 17:26:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 72,440 KB
実行使用メモリ 56,584 KB
最終ジャッジ日時 2023-10-11 10:56:06
合計ジャッジ時間 4,410 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,904 KB
testcase_01 AC 115 ms
56,024 KB
testcase_02 AC 115 ms
56,084 KB
testcase_03 AC 114 ms
56,016 KB
testcase_04 AC 117 ms
53,848 KB
testcase_05 AC 117 ms
55,884 KB
testcase_06 AC 114 ms
56,584 KB
testcase_07 AC 116 ms
55,820 KB
testcase_08 AC 116 ms
56,020 KB
testcase_09 AC 113 ms
55,700 KB
testcase_10 AC 118 ms
55,700 KB
testcase_11 AC 117 ms
55,684 KB
testcase_12 AC 115 ms
56,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {

		StringBuilder sb = new StringBuilder(sc.next());
		int length = sb.length();
		for (int i=length; i>=0; i--) {
			if (length-i!=0 && i!=0) {
				if ((length-i)%3==0) sb.insert(i,",");
			}

		}
		System.out.println(sb);
	}
}
0