結果

問題 No.1233 割り切れない気持ち
ユーザー semisagisemisagi
提出日時 2020-09-18 22:01:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 174 ms / 3,153 ms
コード長 1,581 bytes
コンパイル時間 2,574 ms
コンパイル使用メモリ 104,324 KB
実行使用メモリ 48,608 KB
最終ジャッジ日時 2023-09-04 21:47:46
合計ジャッジ時間 9,557 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
23,500 KB
testcase_01 AC 76 ms
23,464 KB
testcase_02 AC 76 ms
23,464 KB
testcase_03 AC 85 ms
23,524 KB
testcase_04 AC 84 ms
23,728 KB
testcase_05 AC 76 ms
25,520 KB
testcase_06 AC 77 ms
27,660 KB
testcase_07 AC 98 ms
26,392 KB
testcase_08 AC 110 ms
30,672 KB
testcase_09 AC 158 ms
45,100 KB
testcase_10 AC 159 ms
42,000 KB
testcase_11 AC 98 ms
28,156 KB
testcase_12 AC 170 ms
46,508 KB
testcase_13 AC 167 ms
44,472 KB
testcase_14 AC 174 ms
48,608 KB
testcase_15 AC 171 ms
48,468 KB
testcase_16 AC 172 ms
48,472 KB
testcase_17 AC 135 ms
40,288 KB
testcase_18 AC 157 ms
46,512 KB
testcase_19 AC 159 ms
46,056 KB
testcase_20 AC 135 ms
38,444 KB
testcase_21 AC 140 ms
39,884 KB
testcase_22 AC 141 ms
41,912 KB
testcase_23 AC 141 ms
41,904 KB
testcase_24 AC 141 ms
41,912 KB
testcase_25 AC 140 ms
41,956 KB
testcase_26 AC 142 ms
41,948 KB
testcase_27 AC 151 ms
45,752 KB
testcase_28 AC 150 ms
43,616 KB
testcase_29 AC 151 ms
43,640 KB
testcase_30 AC 150 ms
45,520 KB
testcase_31 AC 153 ms
45,520 KB
testcase_32 AC 152 ms
43,500 KB
testcase_33 AC 151 ms
45,500 KB
testcase_34 AC 152 ms
43,372 KB
testcase_35 AC 151 ms
41,280 KB
testcase_36 AC 150 ms
43,376 KB
testcase_37 AC 76 ms
23,456 KB
testcase_38 AC 135 ms
38,376 KB
testcase_39 AC 144 ms
41,652 KB
testcase_40 AC 144 ms
39,528 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3 {
    class Program {
        static void Main(string[] args) {
            var scanner = new Scanner();
            int N = scanner.NextInt();
            long[] A = new long[N];
            long[] F = new long[400001];
            long total = 0;

            for (int i = 0; i < N; i++) {
                A[i] = scanner.NextInt();
                F[A[i]]++;
                total += A[i];
            }

            long[] S = new long[400002];
            for (int i = 0; i <= 400000; i++) {
                S[i + 1] = S[i] + F[i];
            }

            long answer = total * N;

            for (long i = 1; i <= 200000; i++) {
                for (long j = 0; i * j <= 200000; j++) {
                    answer -= i * j * (S[i * (j + 1)] - S[i * j]) * F[i];
                }
            }

            Console.WriteLine(answer);
        }
    }

    class Scanner {
        int index = 0;
        string[] tokens = { };

        public string Next() {
            if (index == tokens.Length) {
                index = 0;
                tokens = Console.ReadLine().Split(' ');
            }
            return tokens[index++];
        }

        public int NextInt() {
            return int.Parse(Next());
        }

        public long NextLong() {
            return long.Parse(Next());
        }

        public double NextDouble() {
            return double.Parse(Next());
        }
    }
}
0