結果

問題 No.293 4>7の世界
ユーザー takatowin
提出日時 2017-01-09 15:20:51
言語 C90
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 780 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-18 00:18:19
合計ジャッジ時間 829 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 13 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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",s,t);
      |   ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main(void){
  char s[11],t[11];
  int num,i;
  scanf("%s %s",s,t);
  if(strlen(s)>strlen(t))
    puts(s);
  else if(strlen(t)>strlen(s))
    puts(t);
  else{
    for(i=0;i<strlen(s);i++){
      if(s[i]>t[i]){
        if(!(s[i]=='7' && t[i]=='4')){
          puts(s);
          goto end;
        }
        else{
          puts(t);
          goto end;
        }
      }else if(s[i]=='4' && t[i]=='7'){
        puts(s);
        goto end;
      }else if(t[i]>s[i]){
        if(!(t[i]=='7' && s[i]=='4')){
          puts(t);
          goto end;
        }else{
          puts(s);
          goto end;
        }
      }else if(t[i]=='4' && s[i]=='7'){
        puts(t);
        goto end;
      }
    }
  }
  puts(t);
  end:
  num=1;
  return 0;
}

0