結果

問題 No.201 yukicoderじゃんけん
ユーザー umashikaumashika
提出日時 2016-02-01 20:13:01
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 21,320 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 18:30:55
合計ジャッジ時間 987 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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