結果

問題 No.39 桁の数字を入れ替え
ユーザー kano_town
提出日時 2014-11-21 19:28:21
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 3,627 ms
コンパイル使用メモリ 76,712 KB
実行使用メモリ 41,724 KB
最終ジャッジ日時 2025-01-02 20:01:55
合計ジャッジ時間 6,280 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder39 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		
		char buf;
		int max = -1;
		for (int i = 0; i < c.length - 1; i++) {
			for (int j = i + 1; j < c.length; j++) {
				buf = c[i];
				c[i] = c[j];
				c[j] = buf;

				max = Math.max(max, Integer.parseInt(String.valueOf(c)));
				
				buf = c[i];
				c[i] = c[j];
				c[j] = buf;

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