結果

問題 No.781 円周上の格子点の数え上げ
ユーザー bluemeganebluemegane
提出日時 2019-01-16 12:50:01
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 2,969 ms
コンパイル使用メモリ 109,148 KB
実行使用メモリ 27,160 KB
最終ジャッジ日時 2023-09-10 04:43:11
合計ジャッジ時間 8,599 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
27,160 KB
testcase_01 WA -
testcase_02 AC 57 ms
22,760 KB
testcase_03 AC 57 ms
20,760 KB
testcase_04 AC 56 ms
20,756 KB
testcase_05 AC 57 ms
20,580 KB
testcase_06 AC 57 ms
22,780 KB
testcase_07 AC 58 ms
20,896 KB
testcase_08 AC 67 ms
20,808 KB
testcase_09 AC 67 ms
18,560 KB
testcase_10 AC 252 ms
20,644 KB
testcase_11 AC 1,225 ms
18,668 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var ans = 0;
        for (int i = a; i <= b; i++)
            ans = Max(ans, getAns(i));
        Console.WriteLine(ans);
    }
    static int getAns(int r)
    {
        var count = 0;
        for (int i = 0; i * i <= r; i++)
            for (int j = i + 1; j * j <= r; j++)
                if (i * i + j * j == r)
                    if (i == 0 | j == 0) count += 4;
                    else count += 8;
        return count;
    }
}

0