結果
問題 | No.256 桁の数字を入れ替え (2) |
ユーザー |
![]() |
提出日時 | 2015-08-03 11:01:57 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 275 bytes |
コンパイル時間 | 614 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 00:58:09 |
合計ジャッジ時間 | 1,014 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d", &n); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int i, j, n, num[10] = {0}, ans; scanf("%d", &n); while(n > 0){ num[n % 10]++; n /= 10; } ans = 0; for(i = 9;i >= 0;i--){ for(j = 0;j < num[i];j++){ ans += i; ans *= 10; } } printf("%d\n", ans / 10); return 0; }