結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー shinwisteriashinwisteria
提出日時 2018-03-14 20:49:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 696 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 3,215 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 64,836 KB
最終ジャッジ日時 2024-05-06 18:47:53
合計ジャッジ時間 5,371 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
53,812 KB
testcase_01 AC 124 ms
54,064 KB
testcase_02 AC 696 ms
64,672 KB
testcase_03 AC 671 ms
64,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Arrays;
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[n.length()];
		for(int i = 0;i < n.length();i++){
			a[i] = -1 * Integer.parseInt(n.substring(i, i+1));
		}
		Arrays.sort(a);
		for(int i = 0;i < n.length();i++){
			System.out.print(-1 * a[i]);
		}
		System.out.println();

	}

}
0