結果

問題 No.39 桁の数字を入れ替え
ユーザー C_kumoC_kumo
提出日時 2019-01-23 00:28:11
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 28,220 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 09:20:27
合計ジャッジ時間 1,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 0 ms
4,352 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 0 ms
4,348 KB
testcase_11 AC 0 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void)
{
	char n[11],i,j,tmp;
	int a,b;
	scanf("%s",n);

	for (i=0;i<9;i++) {
		a = n[i] - '0';
		for (j=8;j>i;j--) {
			if (n[j] < '0' || n[j] > '9') continue;
			b = n[j] - '0';
			if (a < b) {
				tmp = n[i];
				n[i] = n[j];
				n[j] = tmp;
				printf("%s\n",n);
				return 0;
			}
		}
	}
	printf("%s\n",n);
		
	return 0;
}
0