結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-28 21:20:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 826 bytes |
コンパイル時間 | 1,786 ms |
コンパイル使用メモリ | 107,776 KB |
実行使用メモリ | 183,876 KB |
最終ジャッジ日時 | 2024-10-14 13:57:26 |
合計ジャッジ時間 | 5,443 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 10 TLE * 2 -- * 18 |
コンパイルメッセージ
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])).GroupBy(x => x).Where(x => x.Key >= 0).ToDictionary(x => x.Key, x => x.Count()); Console.WriteLine(pows.SelectMany(x => pows.Select(y => x + y)).Sum(x => dict.ContainsKey(x) ? dict[x] : 0)); } }