結果

問題 No.43 野球の試合
ユーザー kou6839kou6839
提出日時 2014-11-25 14:58:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,000 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 74,008 KB
実行使用メモリ 56,376 KB
最終ジャッジ日時 2023-08-30 22:51:55
合計ジャッジ時間 4,505 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,132 KB
testcase_01 AC 118 ms
56,176 KB
testcase_02 AC 120 ms
55,832 KB
testcase_03 AC 120 ms
55,576 KB
testcase_04 AC 118 ms
56,052 KB
testcase_05 AC 120 ms
55,552 KB
testcase_06 AC 118 ms
55,784 KB
testcase_07 AC 120 ms
56,376 KB
testcase_08 AC 121 ms
56,216 KB
testcase_09 AC 122 ms
56,056 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		char[][] kekka = new char[n][n];
		int[] kazu = new int[n];
		for(int i=0;i<n;i++){
			String ss=sc.next();
			for(int j=0;j<n;j++){
				kekka[i][j]=ss.charAt(j);
				if(kekka[i][j]=='o') kazu[i]++;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(kekka[i][j]=='-'){
					if(i==0){
						kekka[i][j]='o';
						kekka[j][i]='x';
						kazu[0]++;
					}else{
						if(kazu[i]>kazu[j]){
							kekka[i][j]='x';
							kekka[j][i]='o';
							kazu[j]++;
						}else{
							kekka[i][j]='o';
							kekka[j][i]='x';
							kazu[i]++;
						}
					}
				}
			}
		}
		int aa=kazu[0];
		Arrays.sort(kazu);
		int ans=1;
		int now=kazu[n-1];
		for(int i=n-1;i>=0;i--){
			if(kazu[i]<now){
				ans++;
				now=kazu[i];
			}
			if(now==aa){
				break;
			}
		}
		System.out.println(ans);
	}
}	
0