結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2015-01-22 23:45:15 |
言語 | Java (openjdk 23) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,635 bytes |
コンパイル時間 | 2,296 ms |
コンパイル使用メモリ | 78,284 KB |
実行使用メモリ | 54,324 KB |
最終ジャッジ日時 | 2024-10-07 03:31:06 |
合計ジャッジ時間 | 6,248 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 WA * 3 |
ソースコード
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);}}