結果

問題 No.2132 1 or X Game
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-26 00:15:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 434 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 2,367 ms
コンパイル使用メモリ 67,840 KB
実行使用メモリ 37,196 KB
最終ジャッジ日時 2023-09-26 00:15:54
合計ジャッジ時間 8,594 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,888 KB
testcase_01 AC 434 ms
37,108 KB
testcase_02 AC 415 ms
37,196 KB
testcase_03 AC 340 ms
35,004 KB
testcase_04 AC 427 ms
36,980 KB
testcase_05 AC 407 ms
34,992 KB
testcase_06 AC 434 ms
37,104 KB
testcase_07 AC 408 ms
36,984 KB
testcase_08 AC 405 ms
35,232 KB
testcase_09 AC 289 ms
30,932 KB
testcase_10 AC 373 ms
35,220 KB
testcase_11 AC 366 ms
35,140 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()
    {
        var t = NN;
        var ans = new long[t];
        for (var u = 0; u < t; ++u)
        {
            var c = NList;
            var (n, x) = (c[0], c[1]);
            if (x % 2 == 1 || n < x)
            {
                ans[u] = (n + 1) / 2;
            }
            else
            {
                ans[u] = x / 2 + (n - x) / (x + 3) * (x + 4) / 2 + (n - x) % (x + 3) / 2 + 1;
            }
        }
        WriteLine(string.Join("\n", ans.Select(ai => ai % 998_244_353)));
    }
}
0