結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
keymoon
|
| 提出日時 | 2019-03-28 21:20:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 826 bytes |
| 記録 | |
| コンパイル時間 | 824 ms |
| コンパイル使用メモリ | 108,416 KB |
| 実行使用メモリ | 197,660 KB |
| 最終ジャッジ日時 | 2026-05-02 00:13:14 |
| 合計ジャッジ時間 | 15,118 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 11 TLE * 8 -- * 11 |
コンパイルメッセージ
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));
}
}
keymoon