結果

問題 No.1280 Beyond C
ユーザー EvolMax
提出日時 2020-11-12 09:36:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 975 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 74,516 KB
実行使用メモリ 59,568 KB
最終ジャッジ日時 2024-07-22 19:05:05
合計ジャッジ時間 12,812 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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