結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー shinwisteriashinwisteria
提出日時 2018-03-14 20:39:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,021 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 4,939 ms
コンパイル使用メモリ 73,684 KB
実行使用メモリ 60,000 KB
最終ジャッジ日時 2023-08-19 11:10:37
合計ジャッジ時間 6,596 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,572 KB
testcase_01 AC 116 ms
55,756 KB
testcase_02 AC 1,018 ms
60,000 KB
testcase_03 AC 1,021 ms
59,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con256 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String n = s.nextLine();
		s.close();

		int[] a = new int[10];
		for(int i = 0;i < n.length();i++){
			a[Integer.parseInt(n.substring(i, i+1))]++;
		}
		n = "";
		for(int i = 9;i >= 0;i--){
			for(int j = 0;j < a[i];j++){
				n += Integer.toString(i);
			}
		}
		System.out.println(n);

	}

}
0