結果
問題 | No.39 桁の数字を入れ替え |
ユーザー | ルッツファン |
提出日時 | 2015-11-28 08:27:40 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 835 bytes |
コンパイル時間 | 3,044 ms |
コンパイル使用メモリ | 71,360 KB |
実行使用メモリ | 51,236 KB |
最終ジャッジ日時 | 2023-10-12 05:05:08 |
合計ジャッジ時間 | 4,857 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
49,300 KB |
testcase_01 | AC | 39 ms
49,288 KB |
testcase_02 | AC | 39 ms
49,304 KB |
testcase_03 | AC | 39 ms
49,192 KB |
testcase_04 | AC | 39 ms
49,028 KB |
testcase_05 | AC | 39 ms
49,148 KB |
testcase_06 | AC | 41 ms
49,224 KB |
testcase_07 | AC | 39 ms
49,372 KB |
testcase_08 | WA | - |
testcase_09 | AC | 40 ms
49,404 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 40 ms
49,312 KB |
testcase_15 | AC | 41 ms
49,388 KB |
testcase_16 | AC | 40 ms
49,152 KB |
testcase_17 | AC | 40 ms
49,212 KB |
testcase_18 | AC | 41 ms
49,532 KB |
ソースコード
package yukicoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class yukicoder014 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } char[] tmp = tes.toCharArray(); char s = '1'; int num = -1; for(int i = 0;i<tmp.length;i++){ if(tmp[i] >= s){ s = tmp[i]; num = i; } } char aaa = 0; for(int i = 0;i<tmp.length;i++){ if(tmp[i] < s){ aaa = tmp[i]; tmp[i] = s; tmp[num] = aaa; break; } } System.out.println(String.copyValueOf(tmp)); } }