結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,504 KB
testcase_01 AC 3 ms
5,504 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[1000000] = {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