結果

問題 No.39 桁の数字を入れ替え
ユーザー ルッツファンルッツファン
提出日時 2015-11-28 08:30:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 873 bytes
コンパイル時間 4,127 ms
コンパイル使用メモリ 71,736 KB
実行使用メモリ 49,308 KB
最終ジャッジ日時 2023-10-12 05:05:14
合計ジャッジ時間 4,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,124 KB
testcase_01 AC 40 ms
49,116 KB
testcase_02 AC 39 ms
49,200 KB
testcase_03 AC 40 ms
49,100 KB
testcase_04 AC 40 ms
49,124 KB
testcase_05 AC 39 ms
49,140 KB
testcase_06 AC 40 ms
49,232 KB
testcase_07 AC 41 ms
49,184 KB
testcase_08 AC 39 ms
49,076 KB
testcase_09 AC 40 ms
49,200 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 39 ms
49,304 KB
testcase_15 AC 40 ms
49,124 KB
testcase_16 AC 40 ms
49,144 KB
testcase_17 AC 39 ms
49,264 KB
testcase_18 AC 40 ms
49,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(num == 0){
				break;
			}
			if(tmp[i] < s){
				aaa = tmp[i];
				
				tmp[i] = s;
				
				tmp[num] = aaa;
				
				
				break;
			}
		}
		
		
		
		
		
		System.out.println(String.copyValueOf(tmp));
		
		
		
	}

}
0