結果
問題 |
No.256 桁の数字を入れ替え (2)
|
ユーザー |
![]() |
提出日時 | 2017-03-31 20:51:54 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 04:47:24 |
合計ジャッジ時間 | 561 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:14:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include<stdlib.h> #include<string.h> int main(void) { int n; int h; int m; int t; int q; int z; int temp; char s[8]; scanf("%d",&n); sprintf(s,"%d",n); for(h=0;h<strlen(s);h++){ for(m=strlen(s)-1;m>h;m--){ if(s[m]<s[m-1]){ temp=s[m-1]; s[m-1]=s[m]; s[m]=temp; } } } for(h=strlen(s)-1;h>=0;h--){ printf("%c",s[h]); } printf("\n"); return 0; }