結果

問題 No.39 桁の数字を入れ替え
ユーザー takatowin
提出日時 2017-01-09 03:23:28
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 259 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 20,224 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 23:59:16
合計ジャッジ時間 853 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%s",s);
      |   ^~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main(void){
  char s[10],temp;
  int num=0,i;
  scanf("%s",s);
  temp=s[0];
  for(i=1;i<strlen(s);i++){
    if(s[i]>=temp){
      temp=s[i];
      num=i;
    }
  }
  s[num]=s[0];
  s[0]=temp;
  puts(s);
  return 0;
}

0