結果

問題 No.2177 Recurring ab
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-04 21:35:58
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,192 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 68,296 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2023-09-04 21:36:03
合計ジャッジ時間 4,242 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
22,728 KB
testcase_01 AC 54 ms
22,720 KB
testcase_02 AC 54 ms
20,752 KB
testcase_03 AC 52 ms
18,804 KB
testcase_04 AC 54 ms
22,792 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 55 ms
22,732 KB
testcase_08 AC 54 ms
22,688 KB
testcase_09 AC 53 ms
20,716 KB
testcase_10 AC 54 ms
20,664 KB
testcase_11 AC 54 ms
22,812 KB
testcase_12 AC 54 ms
20,672 KB
testcase_13 AC 54 ms
22,704 KB
testcase_14 AC 54 ms
20,592 KB
testcase_15 AC 54 ms
22,760 KB
testcase_16 WA -
testcase_17 AC 54 ms
20,632 KB
testcase_18 AC 54 ms
22,692 KB
testcase_19 AC 54 ms
20,696 KB
testcase_20 AC 57 ms
20,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        long n = NN;
        var ans = 0L;
        for (var p = 2; p <= 20; ++p) for (var a = 0; a < p && a < 10; ++a) for (var b = 0; b < p && b < 10; ++b)
        {
            if (a == b) continue;
            if ((a * p + b) < p * p - 1 && n * (a * p + b) > p * p - 1)
            {
                ++ans;
            }
        }
        for (var a = 0; a < 10; ++a) for (var b = 0; b < 10; ++b)
        {
            if (a == b) continue;
            if (n * (a * 21 + b) <= 21 * 21 - 1) break;
            var ok = 21L;
            var ng = 1_000_000_001L;
            while (ng - ok > 1)
            {
                var mid = (ok + ng) / 2;
                if (n * (a * mid + b) > mid * mid - 1) ok = mid;
                else ng = mid;
            }
            ans += ok - 20;
        }
        WriteLine(ans);
    }
}
0