結果

問題 No.800 四平方定理
ユーザー keymoonkeymoon
提出日時 2019-03-28 21:26:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 428 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 1,129 ms
コンパイル使用メモリ 107,872 KB
実行使用メモリ 38,528 KB
最終ジャッジ日時 2024-04-22 15:08:49
合計ジャッジ時間 7,669 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
19,280 KB
testcase_01 AC 34 ms
19,048 KB
testcase_02 AC 33 ms
19,160 KB
testcase_03 AC 32 ms
19,024 KB
testcase_04 AC 33 ms
19,032 KB
testcase_05 AC 32 ms
19,160 KB
testcase_06 AC 34 ms
19,180 KB
testcase_07 AC 34 ms
19,044 KB
testcase_08 AC 39 ms
18,944 KB
testcase_09 AC 34 ms
19,072 KB
testcase_10 AC 171 ms
28,288 KB
testcase_11 AC 188 ms
28,544 KB
testcase_12 AC 197 ms
29,568 KB
testcase_13 AC 168 ms
27,136 KB
testcase_14 AC 183 ms
27,648 KB
testcase_15 AC 189 ms
29,568 KB
testcase_16 AC 188 ms
27,904 KB
testcase_17 AC 184 ms
27,776 KB
testcase_18 AC 211 ms
31,744 KB
testcase_19 AC 214 ms
31,488 KB
testcase_20 AC 29 ms
19,072 KB
testcase_21 AC 30 ms
19,072 KB
testcase_22 AC 230 ms
31,616 KB
testcase_23 AC 424 ms
38,528 KB
testcase_24 AC 332 ms
34,816 KB
testcase_25 AC 428 ms
38,528 KB
testcase_26 AC 30 ms
19,072 KB
testcase_27 AC 30 ms
19,328 KB
testcase_28 AC 348 ms
34,688 KB
testcase_29 AC 366 ms
36,736 KB
testcase_30 AC 349 ms
34,688 KB
testcase_31 AC 322 ms
33,536 KB
testcase_32 AC 360 ms
35,200 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.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;

static class P
{
    static void Main()
    {
        var nd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] pows = Enumerable.Range(1, nd[0]).Select(x => x * x).ToArray();
        var dict = pows.SelectMany(x => pows.Select(y => x - y + nd[1])).Aggregate(new int[nd[0] * nd[0] + Max(nd[1], nd[0] * nd[0] + 1)], (x, y) => {
                if (y <= 0) return x;
                x[y]++;
                return x;
            });
        Console.WriteLine(pows.SelectMany(x => pows.Select(y => x + y)).Sum(x => dict[x]));
    }
}
0