結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ixTL255ixTL255
提出日時 2019-02-06 02:06:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 478 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 3,253 ms
コンパイル使用メモリ 108,928 KB
実行使用メモリ 101,288 KB
最終ジャッジ日時 2023-08-31 00:02:22
合計ジャッジ時間 8,030 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,656 KB
testcase_01 AC 60 ms
21,796 KB
testcase_02 AC 59 ms
21,796 KB
testcase_03 AC 61 ms
21,892 KB
testcase_04 AC 60 ms
21,720 KB
testcase_05 AC 61 ms
23,836 KB
testcase_06 AC 61 ms
21,840 KB
testcase_07 AC 62 ms
24,136 KB
testcase_08 AC 410 ms
101,288 KB
testcase_09 AC 408 ms
99,288 KB
testcase_10 AC 62 ms
19,828 KB
testcase_11 AC 62 ms
23,844 KB
testcase_12 AC 446 ms
99,364 KB
testcase_13 AC 478 ms
99,292 KB
testcase_14 AC 73 ms
25,760 KB
testcase_15 AC 62 ms
23,840 KB
testcase_16 AC 62 ms
23,688 KB
testcase_17 AC 301 ms
69,596 KB
testcase_18 AC 259 ms
67,460 KB
testcase_19 AC 267 ms
68,868 KB
testcase_20 AC 264 ms
68,872 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;

public class Yuki781
{
	public static void Main()
	{
		var ab = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
		var cnt = new long[ab[1] + 1];
		var r = (int)Math.Sqrt(ab[1]);
		for (int i = 0; i <= r; ++i)
		{
			for (int j = 1; j <= r; ++j)
			{
				var d = i * i + j* j;
				if(d <= ab[1]) cnt[d]++;
			}
		}
		long max = 0;
		for(int i = ab[0]; i <= ab[1]; ++i) max = Math.Max(max, cnt[i]);
		Console.WriteLine(max * 4);
	}
}
0