結果

問題 No.256 桁の数字を入れ替え (2)
コンテスト
ユーザー zazaboon
提出日時 2015-08-09 00:48:22
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
実行時間 -
コード長 372 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 105 ms
コンパイル使用メモリ 29,892 KB
最終ジャッジ日時 2026-02-23 19:09:58
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    9 |         scanf("%s",keta);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | int sort(const void*a,const void*b)
main.c:10:19: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   10 |         ketasuu = strlen(keta);
      |                   ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
  +++ |+#include <string.h>
    1 | int sort(const void*a,const void*b)
main.c:18:17: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   18 |                 printf("%d",keta_int[i]-48);
      |                 ^~~~~~
main.c:18:17: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #
raw source code

int sort(const void*a,const void*b) 
{
	return *(int *)b - *(int *)a;
}
int main (void)
{
	int i,ketasuu=0,keta_int[10000];
	char	keta[10000];
	scanf("%s",keta);
	ketasuu = strlen(keta);
	for(i=0;i<ketasuu;i++)
	{
		keta_int[i]=keta[i];
	}
	qsort((void *)keta_int,ketasuu,sizeof(keta_int[0]),sort);
	for(i=0;i<ketasuu;i++)
	{
		printf("%d",keta_int[i]-48);
	}
	return 0;
}
0