結果

問題 No.43 野球の試合
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-22 19:12:49
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 983 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 25,320 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 21:15:46
合計ジャッジ時間 1,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void){
	int mp=0, ml=1;
	int i,j,k,n;
	int rank[10]={0};
	char s[10][100];
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		scanf("%s", s[i]);
	}
	
	for(i=0;i<n;i++){
		if(s[0][i] == '-'){		s[0][i] = 'o';	}
		if(s[i][0] == '-'){		s[i][0] = 'x';	}
		if(s[0][i] == 'o'){			mp++;		}
	}
	
	while(1){
		int tmp = 0, team=0;
		for(j=1;j<n;j++){
			int ttmp = 0,e=0;
			for(k=0;k<n;k++){
				if(s[j][k] == 'o'){	ttmp++;}
				if(s[j][k] == '-'){	ttmp++;e++;}
			}
			if(e == 0){
				ttmp = 0;
			}
			if( tmp < ttmp){
				tmp = ttmp;
				team = j;
			}
		}
		
		for(j=0;j<n;j++){
			if(s[team][j] == '-'){		s[team][j] = 'x';	}
			if(s[j][team] == '-'){		s[j][team] = 'o';	}
		}
		if(team == 0){
			break;
		}
	}
	
	
	// 自分の得点
	
	for(i=1;i<n;i++){
		int tmp = 0;
		for(j=0;j<n;j++){
			if(s[i][j] == 'o'){	tmp++;}
		}
		
		if( mp < tmp ){
			rank[tmp] = 1;
		}
	}
	
	for(i=1;i<10;i++){
		if(rank[i] != 0){ml=i;break;}
	}
	
	printf("%d \n", ml);
	
	return 0;
}
0