結果

問題 No.1280 Beyond C
ユーザー tentententen
提出日時 2020-11-09 09:30:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 816 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 3,359 ms
コンパイル使用メモリ 72,204 KB
実行使用メモリ 66,676 KB
最終ジャッジ日時 2023-09-29 21:58:17
合計ジャッジ時間 10,917 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,872 KB
testcase_01 AC 117 ms
56,180 KB
testcase_02 AC 116 ms
55,924 KB
testcase_03 AC 116 ms
56,232 KB
testcase_04 AC 116 ms
56,344 KB
testcase_05 AC 119 ms
56,084 KB
testcase_06 AC 118 ms
56,500 KB
testcase_07 AC 122 ms
56,108 KB
testcase_08 AC 118 ms
54,032 KB
testcase_09 AC 116 ms
56,324 KB
testcase_10 AC 117 ms
56,140 KB
testcase_11 AC 186 ms
58,280 KB
testcase_12 AC 154 ms
55,900 KB
testcase_13 AC 180 ms
58,496 KB
testcase_14 AC 183 ms
56,104 KB
testcase_15 AC 629 ms
61,464 KB
testcase_16 AC 564 ms
60,800 KB
testcase_17 AC 615 ms
61,556 KB
testcase_18 AC 731 ms
66,676 KB
testcase_19 AC 767 ms
65,044 KB
testcase_20 AC 795 ms
65,096 KB
testcase_21 AC 816 ms
65,076 KB
testcase_22 AC 789 ms
65,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long c = sc.nextLong();
        int[] aArr = new int[n];
        for (int i = 0; i < n; i++) {
            aArr[i] = sc.nextInt();
        }
        Arrays.sort(aArr);
        int[] bArr = new int[m];
        for (int i = 0; i < m; i++) {
            bArr[i] = sc.nextInt();
        }
        Arrays.sort(bArr);
        long count = 0;
        int idx = m;
        for (int i = 0; i < n; i++) {
            while (idx > 0 && (long)aArr[i] * bArr[idx - 1] > c) {
                idx--;
            }
            count += m - idx;
        }
        System.out.println((double)count / n / m);
    }
}
0