結果

問題 No.39 桁の数字を入れ替え
ユーザー takatowin
提出日時 2017-01-09 03:22:50
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 657 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 23:59:11
合計ジャッジ時間 1,170 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
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