結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
![]() |
提出日時 | 2019-02-06 02:06:45 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 438 ms / 2,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 1,146 ms |
コンパイル使用メモリ | 112,472 KB |
実行使用メモリ | 97,152 KB |
最終ジャッジ日時 | 2025-01-03 00:21:40 |
合計ジャッジ時間 | 4,774 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
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; 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); } }