結果

問題 No.201 yukicoderじゃんけん
ユーザー umashika
提出日時 2016-02-01 20:13:01
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-21 19:51:25
合計ジャッジ時間 776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |   scanf("%s %s %c",s1,p1,&x1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:14:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |   scanf("%s %s %c",s2,p2,&x2);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main(void)
{
  char s1[101];
  char s2[101];
  char p1[1000000];
  char p2[1000000];
  int len_p1,len_p2;
  char x1,x2;
  int i;

  scanf("%s %s %c",s1,p1,&x1);
  scanf("%s %s %c",s2,p2,&x2);

  len_p1=strlen(p1);
  len_p2=strlen(p2);

  if(len_p1 > len_p2){
    printf("%s\n",s1);
  }
  else if(len_p1 < len_p2){
    printf("%s\n",s2);
  }
  else{
    for(i=0;i<len_p1;i++){
      if(p1[i]>p2[i]){
        printf("%s\n",s1);
        break;
      }
      else if(p1[i]<p2[i]){
        printf("%s\n",s2);
        break;
      }
      else if(i == len_p1-1){
        printf("-1\n");
        break;
      }
    }
  }
  return 0;
}
0