結果
| 問題 |
No.256 桁の数字を入れ替え (2)
|
| コンテスト | |
| ユーザー |
zazaboon
|
| 提出日時 | 2015-08-09 00:01:55 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 556 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 21,760 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 06:07:03 |
| 合計ジャッジ時間 | 609 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&nyuryoku);
| ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<stdlib.h>
int sort(const void*a,const void*b)
{
return *(int *)b - *(int *)a;
}
int main (void)
{
int nyuryoku,nyuryoku_c;
int i,ketasuu=0,keta[9999],j;
scanf("%d",&nyuryoku);
nyuryoku_c = nyuryoku;
for(i=0;nyuryoku_c!=0;i++)
{
nyuryoku_c /= 10;
ketasuu++;
};
for(i=0;i<ketasuu;i++)
{
nyuryoku_c = nyuryoku;
for(j=i;j<ketasuu-1;j++)
{
nyuryoku_c/=10;
}
keta[i] = nyuryoku_c % 10;
}
qsort((void *)keta,ketasuu,sizeof(keta[0]),sort);
for(i=0;i<ketasuu;i++)
{
printf("%d",keta[i]);
}
return 0;
}
zazaboon