結果

問題 No.133 カードゲーム
ユーザー ki_ki33ki_ki33
提出日時 2015-01-22 23:45:15
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,635 bytes
コンパイル時間 2,760 ms
コンパイル使用メモリ 78,560 KB
実行使用メモリ 41,460 KB
最終ジャッジ日時 2024-04-16 10:28:15
合計ジャッジ時間 6,217 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,284 KB
testcase_01 AC 120 ms
40,400 KB
testcase_02 AC 131 ms
41,392 KB
testcase_03 AC 131 ms
41,124 KB
testcase_04 AC 117 ms
40,064 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 131 ms
41,332 KB
testcase_09 AC 133 ms
41,220 KB
testcase_10 AC 132 ms
41,292 KB
testcase_11 AC 129 ms
41,228 KB
testcase_12 AC 131 ms
41,264 KB
testcase_13 AC 131 ms
41,232 KB
testcase_14 AC 130 ms
41,272 KB
testcase_15 AC 118 ms
39,996 KB
testcase_16 AC 131 ms
41,120 KB
testcase_17 AC 122 ms
40,904 KB
testcase_18 AC 128 ms
41,076 KB
testcase_19 AC 118 ms
40,020 KB
testcase_20 AC 119 ms
40,260 KB
testcase_21 AC 118 ms
40,328 KB
testcase_22 AC 128 ms
41,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static final int C =  1000000007;
	static final int CY = 1000000000;
	//static boolean MAP[][];
	static int N;

	static int M;
	static int MAX = -1;
	//static int tic[][];
	static int A[];
	static int B[];
	//static int max;
	static long DP[];
	static int ST[][];
	//static int p[];
	//static ArrayList<HashSet<Integer>> al;
	static TreeMap<Integer, ArrayList<Integer>> hm;
	//static ArrayList<Integer> al;
	//static int a[][];
	//static char[][] ch;
	//static ArrayList<HashMap<Long, Long>> al;
	//static String a[];
	//static String str;

	public static void main(String[] args) {
		//StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);
		
		N = sc.nextInt();
		
		A = new int[N];
		B = new int[N];
		for (int i=0; i < N; i++) {
			A[i] = sc.nextInt();
			
		}
		for (int i=0; i< N;i++) {
			B[i] = sc.nextInt();
		}
		
		double ans = 0;
		
		double num = 0;
		switch (N) {
		case 1:
			num = 1;
			break;
		case 2:
			num = 2;
			break;
		case 3:
			num = 6;
			break;
		case 4:
			num = 24;
			break;
		}
		double win = 0;
		int c = 0;
		for (int i=0; i < num; i++) {
			
			int in = A[0];
			A[0] = A[c];
			A[c] = in;
			
			c = (c+1 == N? c=1:c+1);
			
			int n = 0;
			
			for (int t =0; t < N; t++) {
				if (A[t] > B[t]) {
					n++;
				}
			}
			if (n > N/2) {
				win++;
			}
		}
		
		ans = win / num;
		
		System.out.println(ans);

	}
	

}
0