結果

問題 No.937 Ultra Sword
ユーザー keymoonkeymoon
提出日時 2019-11-29 22:01:41
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,232 bytes
コンパイル時間 4,385 ms
コンパイル使用メモリ 116,424 KB
実行使用メモリ 42,492 KB
最終ジャッジ日時 2024-05-01 02:31:37
合計ジャッジ時間 16,578 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
19,364 KB
testcase_01 AC 32 ms
19,360 KB
testcase_02 AC 30 ms
19,612 KB
testcase_03 AC 31 ms
19,480 KB
testcase_04 AC 30 ms
19,456 KB
testcase_05 AC 748 ms
33,792 KB
testcase_06 AC 333 ms
30,720 KB
testcase_07 AC 370 ms
31,360 KB
testcase_08 AC 174 ms
27,264 KB
testcase_09 AC 142 ms
26,624 KB
testcase_10 AC 414 ms
31,872 KB
testcase_11 AC 72 ms
25,344 KB
testcase_12 AC 212 ms
30,976 KB
testcase_13 AC 210 ms
30,848 KB
testcase_14 AC 240 ms
31,872 KB
testcase_15 AC 188 ms
30,080 KB
testcase_16 AC 37 ms
20,480 KB
testcase_17 AC 49 ms
24,704 KB
testcase_18 AC 203 ms
30,720 KB
testcase_19 AC 131 ms
27,904 KB
testcase_20 AC 120 ms
27,392 KB
testcase_21 AC 425 ms
32,384 KB
testcase_22 WA -
testcase_23 AC 32 ms
19,200 KB
testcase_24 AC 1,590 ms
32,896 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] sum = new long[100001];
        for (int i = 0; i < n; i++)
            foreach (var div in Divisors(a[i]).Distinct())
                sum[div] += a[i] - (a[i] / div);

        for (int i = 1; ; i <<= 1)
        {
            if (a.Any(x => (x & i) != 0))
            {
                Console.WriteLine(a.Sum() - sum.Where((_, ind) => (ind & (i - 1)) == 0).Max());
                return;
            }
        }
    }

    static IEnumerable<long> Divisors(long n)
    {
        var max = (int)Ceiling(Sqrt(n));
        for (int i = 1; i <= max; i++)
            if (n % i == 0) { yield return i; yield return n / i; }
    }
}
0