結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
keymoon
|
| 提出日時 | 2019-03-28 21:26:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 341 ms / 2,000 ms |
| コード長 | 901 bytes |
| コンパイル時間 | 934 ms |
| コンパイル使用メモリ | 110,988 KB |
| 実行使用メモリ | 38,784 KB |
| 最終ジャッジ日時 | 2024-10-14 14:13:58 |
| 合計ジャッジ時間 | 7,150 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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]));
}
}
keymoon