結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー GrenacheGrenache
提出日時 2015-07-31 22:25:53
言語 Java19
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 1,659 bytes
コンパイル時間 4,245 ms
コンパイル使用メモリ 75,128 KB
実行使用メモリ 52,768 KB
最終ジャッジ日時 2023-09-24 22:45:00
合計ジャッジ時間 5,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,608 KB
testcase_01 AC 46 ms
49,424 KB
testcase_02 AC 114 ms
52,580 KB
testcase_03 AC 116 ms
52,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Iterator;


public class Main_yukicoder256 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        char[] n = sc.next().toCharArray();
        Arrays.sort(n);

        for (int i = n.length - 1; i >= 0; i--) {
        	pr.print(n[i]);
        }
        pr.println("");

    	pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;
		
		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		
		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}
		
		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0