結果

問題 No.1593 Perfect Distance
ユーザー さかぽんさかぽん
提出日時 2021-07-09 23:21:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 2,201 ms
コンパイル使用メモリ 101,888 KB
実行使用メモリ 29,652 KB
最終ジャッジ日時 2023-09-14 10:48:54
合計ジャッジ時間 4,625 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,724 KB
testcase_01 AC 64 ms
22,732 KB
testcase_02 AC 63 ms
22,636 KB
testcase_03 AC 63 ms
22,680 KB
testcase_04 AC 63 ms
22,564 KB
testcase_05 AC 63 ms
22,604 KB
testcase_06 AC 64 ms
24,672 KB
testcase_07 AC 64 ms
22,632 KB
testcase_08 AC 64 ms
22,636 KB
testcase_09 AC 65 ms
24,636 KB
testcase_10 AC 68 ms
24,864 KB
testcase_11 AC 70 ms
21,408 KB
testcase_12 AC 76 ms
24,096 KB
testcase_13 AC 77 ms
24,324 KB
testcase_14 AC 80 ms
24,704 KB
testcase_15 AC 89 ms
25,988 KB
testcase_16 AC 112 ms
29,652 KB
testcase_17 AC 63 ms
20,588 KB
testcase_18 AC 63 ms
22,588 KB
testcase_19 AC 65 ms
24,576 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.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 => set.Contains(n2 - x2));
	}
}
0