結果

問題 No.1280 Beyond C
ユーザー keymoon
提出日時 2021-01-18 11:19:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 1,099 bytes
コンパイル時間 1,165 ms
コンパイル使用メモリ 107,520 KB
実行使用メモリ 45,184 KB
最終ジャッジ日時 2024-11-30 22:49:38
合計ジャッジ時間 4,811 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nmc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var c = nmc[2]; 
        var a = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
        var b = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
        double res = 0;
        for (int i = 0; i < a.Length; i++)
        {
            int valid = -1;
            int invalid = b.Length;
            while ((invalid - valid) > 1)
            {
                var mid = (invalid + valid) / 2;
                if (c < a[i] * b[mid]) valid = mid;
                else invalid = mid;
            }
            res += (double)invalid / b.Length;
        }
        res /= a.Length;
        Console.WriteLine(res);
    }
}
0