結果
問題 | No.2132 1 or X Game |
ユーザー |
|
提出日時 | 2023-09-26 00:15:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 349 ms / 2,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 2,243 ms |
コンパイル使用メモリ | 113,344 KB |
実行使用メモリ | 32,256 KB |
最終ジャッジ日時 | 2024-07-18 19:37:40 |
合計ジャッジ時間 | 7,792 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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)));}}