結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー FF256grhy
提出日時 2015-07-31 22:31:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-17 23:12:48
合計ジャッジ時間 609 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int n, d[10];

int main(void) {
	scanf("%d", &n);
	while(n) {
		d[n % 10]++;
		n /= 10;
	}
	
	int i, j, c = 0, ans = 0;
	for(i = 9; 0 <= i; i--) {
	for(j = 0; j < d[i]; j++) {
		printf("%d", i);
	}
	}
	printf("\n");
	return 0;
}
0