結果

問題 No.39 桁の数字を入れ替え
ユーザー kano_townkano_town
提出日時 2014-11-21 19:28:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 3,032 ms
コンパイル使用メモリ 72,788 KB
実行使用メモリ 56,532 KB
最終ジャッジ日時 2023-08-30 22:10:07
合計ジャッジ時間 6,204 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,872 KB
testcase_01 AC 113 ms
55,868 KB
testcase_02 AC 115 ms
55,636 KB
testcase_03 AC 113 ms
55,396 KB
testcase_04 AC 113 ms
56,348 KB
testcase_05 AC 113 ms
55,580 KB
testcase_06 AC 112 ms
55,636 KB
testcase_07 AC 114 ms
55,960 KB
testcase_08 WA -
testcase_09 AC 113 ms
55,608 KB
testcase_10 AC 113 ms
56,328 KB
testcase_11 AC 113 ms
56,196 KB
testcase_12 AC 113 ms
56,136 KB
testcase_13 AC 113 ms
56,156 KB
testcase_14 AC 116 ms
55,664 KB
testcase_15 AC 115 ms
55,520 KB
testcase_16 AC 113 ms
55,600 KB
testcase_17 AC 113 ms
56,068 KB
testcase_18 AC 114 ms
56,380 KB
権限があれば一括ダウンロードができます

ソースコード

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