結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー butsurizuki
提出日時 2016-12-03 18:58:05
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 18:03:16
合計ジャッジ時間 632 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%s",s);
      |         ^~~~~~~~~~~~~

ソースコード

diff #

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

int sortfnc(const void *a,const void *b){
	if(*(char*)a == *(char*)b){return 0;}
	if(*(char*)a > *(char*)b){return -1;}
	return 1;
}

int main(void){
	int l;
	char s[131072];
	scanf("%s",s);
	l = strlen(s);
	qsort(s,l,sizeof(char),sortfnc);
	printf("%s\n",s);
	return 0;
}
0