結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
ルッツファン
|
| 提出日時 | 2015-11-28 08:27:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 835 bytes |
| コンパイル時間 | 3,258 ms |
| コンパイル使用メモリ | 73,184 KB |
| 実行使用メモリ | 37,128 KB |
| 最終ジャッジ日時 | 2024-09-14 04:36:18 |
| 合計ジャッジ時間 | 4,891 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 5 |
ソースコード
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));
}
}
ルッツファン