結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー mosmos_21mosmos_21
提出日時 2016-10-12 18:14:58
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 19:20:07
合計ジャッジ時間 472 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d", &in);
      |   ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
  int in, out[6] = {0},i = 0, j, t;

  scanf("%d", &in);
  while(in){
    out[i++] = in % 10;
    in /= 10;
  }
  t = i;
  //バブルソート
  for(i = 0; i < t; i++){
    for(j = t-1; j > i; j--){
      if(out[i] > out[j]){
        in = out[i];
        out[i] = out[j];
        out[j] = in;
      }
    }
  }
  
  for(i = t-1;i>-1;i--)
    printf("%d", out[i]);
  puts("");
  
  return 0;
}
0