結果

問題 No.201 yukicoderじゃんけん
ユーザー TLwiegehtt
提出日時 2015-07-08 02:38:10
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 617 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 01:37:35
合計ジャッジ時間 696 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s %s %s", nameA, pointA, handA);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%s %s %s", nameB, pointB, handB);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main(void){
	int ret;
	char nameA[110], nameB[110];
	char pointA[11000], pointB[11000];
	char handA[10], handB[10];
	
	scanf("%s %s %s", nameA, pointA, handA);
	scanf("%s %s %s", nameB, pointB, handB);
	
	if( strlen(pointA) > strlen(pointB) ){
		printf("%s\n", nameA);
	}else if( strlen(pointA) < strlen(pointB) ){
		printf("%s\n", nameB);
	}else{
		if( strlen(pointA) == strlen(pointB) ){
			ret = strcmp(pointA, pointB);
			if( ret > 0 ){
				printf("%s\n", nameA);
			}else if(ret < 0){
				printf("%s\n", nameB);
			}else{
				printf("-1\n");
			}
		}
	}
	
	return 0;
}
0