結果

問題 No.39 桁の数字を入れ替え
ユーザー Mcpu3
提出日時 2018-07-18 15:57:02
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 326 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-14 16:14:29
合計ジャッジ時間 814 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
	char n[10],t;
	int i,j,m;
	scanf("%s",n);
	m=atoi(n);
	for(i=0;i<strlen(n)-1;i++){
		for(j=i+1;j<strlen(n);j++){
			t=n[i];
			n[i]=n[j];
			n[j]=t;
			if(atoi(n)>m)m=atoi(n);
			t=n[i];
			n[i]=n[j];
			n[j]=t;
		}
	}
	printf("%d",m);
	return 0;
}
0