結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kekuremakekurema
提出日時 2019-04-03 09:36:42
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,289 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 106,400 KB
実行使用メモリ 26,988 KB
最終ジャッジ日時 2023-08-22 15:07:31
合計ジャッジ時間 7,873 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
26,988 KB
testcase_01 AC 56 ms
20,636 KB
testcase_02 AC 56 ms
20,580 KB
testcase_03 AC 57 ms
20,700 KB
testcase_04 AC 56 ms
22,628 KB
testcase_05 AC 56 ms
20,640 KB
testcase_06 AC 56 ms
20,624 KB
testcase_07 AC 58 ms
22,688 KB
testcase_08 AC 64 ms
20,560 KB
testcase_09 AC 64 ms
20,604 KB
testcase_10 AC 209 ms
22,620 KB
testcase_11 AC 959 ms
20,596 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Code
{
    class Program
    {
        static void Main(string[] args)
        {

            string line = Console.ReadLine();
            string[] values = line.Split(' ');
            int X = int.Parse(values[0]);
            int Y = int.Parse(values[1]);

            int[] rr = new int[Y / 2 + 2];

            int i = 1;
            while (true)
            {
                int t = i * i;
                if (t > Y) break;
                else
                {
                    rr[i++] = t;
                }
            }

            int maxSum = 0;
            for (int k = X; k <= Y; k++)
            {
                int sum = 0;
                for (int s = 0; s * s <= k / 2; s++)
                {
                    for (int l = s; l * l <= k; l++)
                    {
                        if (s * s + l * l == k)
                        {
                            if (l * l == k || s == l) sum += 4; 
                            else sum += 8;
                        }
                    }
                }
                if (sum > maxSum) maxSum = sum;
            }

            Console.WriteLine(maxSum);
        }
    }
}
0