結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
|
提出日時 | 2019-08-27 10:43:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 141 ms / 2,000 ms |
コード長 | 1,139 bytes |
コンパイル時間 | 4,309 ms |
コンパイル使用メモリ | 74,708 KB |
実行使用メモリ | 54,488 KB |
最終ジャッジ日時 | 2024-11-14 04:19:07 |
合計ジャッジ時間 | 6,346 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
package test.demo; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import java.util.Scanner; public class Yukicoder784 { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ /* * Scanner sc=new Scanner(System.in); int N =sc.nextInt(); if(N>999) { String * str=String.valueOf(N); int a=str.length()%3; if(a!=0) { String * str2=str.substring(0,a)+","; for(int i=a;i<str.length()-a;i=i+3) { * if(i+3>=str.length()) { str2+=str.substring(i,str.length()); }else { * str2+=str.substring(i,i+3)+","; } } System.out.println(str2); }else { String * str2=""; for(int i=0;i<str.length();i=i+3) { if(i+3>=str.length()) { * str2+=str.substring(i,str.length()); }else { str2+=str.substring(i,i+3)+","; * } } System.out.println(str2); } * * }else { System.out.println(N); } */ Scanner stdin = new Scanner(System.in); //System.out.printf("%1$,-3d%n", stdin.nextInt()); //System.out.printf("%tY/%tm/%td%n",new Date(),new Date(),new Date()); System.out.printf("%,d",stdin.nextInt()); } }