結果

問題 No.39 桁の数字を入れ替え
ユーザー mobius_bkst
提出日時 2015-05-03 15:10:07
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 3,044 ms
コンパイル使用メモリ 74,516 KB
実行使用メモリ 37,088 KB
最終ジャッジ日時 2024-07-05 17:38:01
合計ジャッジ時間 4,201 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class No039 {

    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    System.in));
            String S = br.readLine();
            int N = Integer.parseInt(S);
            int max = N;
            int Slength = S.length();
            char[] c;
            char tmp;
            int newN = 0;
            for (int i = 1; i < Slength; i++) {
                c = S.toCharArray();
                tmp = c[i];
                c[i] = c[0];
                c[0] = tmp;
                newN = Integer.parseInt(String.copyValueOf(c));
                max = Math.max(max, newN);
            }

            System.out.println(max);
        } catch (Exception e) {
            System.err.println("Error:" + e.getMessage());
        }
    }

}
0