結果

問題 No.201 yukicoderじゃんけん
ユーザー 158b
提出日時 2015-05-03 23:47:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 745 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 57,044 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 17:54:41
合計ジャッジ時間 1,273 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <string>
using namespace std;

int count(char a[]){
	int i=0;
	while(a[i] != '\0'){
		i++;
	}
	
	return i;
}

int main(){

	char name[2][102];
	char point[2][10002] = {0};
	char te[2][10];

	
	for(int i=0; i<2; i++){
		cin >> name[i];
		cin >> point[i];
		cin >> te[i];
	}
	
	if(count(point[0]) > count(point[1])){
		cout << name[0] << endl;
		return 0;
	}else if(count(point[0]) < count(point[1])){
		cout << name[1] << endl;
		return 0;
	}else{
		
		int i = 0;
		while(point[0][i] == point[1][i] && i < 10001){
			i++;
		}
		
		if(point[0][i] > point[1][i]){
			cout << name[0] << endl;
		}else if(point[0][i] < point[1][i]){
			cout << name[1] << endl;
		}else{
			cout << -1 << endl;
		}
		
	}
	

	
	return 0;
}

0