結果
| 問題 |
No.1593 Perfect Distance
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-09 21:31:29 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 600 bytes |
| コンパイル時間 | 2,113 ms |
| コンパイル使用メモリ | 106,752 KB |
| 実行使用メモリ | 25,344 KB |
| 最終ジャッジ日時 | 2024-07-01 15:19:18 |
| 合計ジャッジ時間 | 7,055 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 1 -- * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class C
{
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
static void Main() => Console.WriteLine(Solve());
static object Solve()
{
var n = long.Parse(Console.ReadLine());
var n2 = n * n;
var p = Enumerable.Range(1, (int)n).Select(x => (long)x * x).ToArray();
var set = p.ToHashSet();
return p.Count(x2 => p.Contains(n2 - x2));
}
}