結果
問題 | No.39 桁の数字を入れ替え |
ユーザー | kou6839 |
提出日時 | 2014-11-18 17:18:08 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 1,959 ms |
コンパイル使用メモリ | 73,728 KB |
実行使用メモリ | 59,188 KB |
最終ジャッジ日時 | 2023-08-30 20:34:10 |
合計ジャッジ時間 | 6,050 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 152 ms
56,840 KB |
testcase_01 | AC | 152 ms
57,004 KB |
testcase_02 | AC | 151 ms
57,056 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 151 ms
56,972 KB |
testcase_08 | AC | 152 ms
56,792 KB |
testcase_09 | AC | 154 ms
56,816 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 151 ms
56,956 KB |
testcase_15 | AC | 155 ms
56,624 KB |
testcase_16 | AC | 154 ms
56,984 KB |
testcase_17 | AC | 154 ms
57,136 KB |
testcase_18 | AC | 154 ms
57,000 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n= sc.nextInt(); String num = n+""; int max = num.charAt(0); int basyo=0; for(int i=1;i<num.length();i++){ if(max<=(int)num.charAt(i)){ basyo=i; max=(int)num.charAt(i); } } char[] sss = num.toCharArray(); char temp = sss[0]; sss[0]=sss[basyo]; sss[basyo]=temp; String ans=""; for(int i=0;i<num.length();i++){ ans+=sss[i]; } System.out.println(ans); } }