結果

問題 No.2132 1 or X Game
ユーザー kabipoyokabipoyo
提出日時 2022-11-25 22:30:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,210 bytes
コンパイル時間 4,290 ms
コンパイル使用メモリ 255,268 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 03:42:30
合計ジャッジ時間 11,457 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 AC 544 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 515 ms
6,940 KB
testcase_05 AC 516 ms
6,940 KB
testcase_06 AC 517 ms
6,944 KB
testcase_07 AC 538 ms
6,940 KB
testcase_08 AC 532 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;

int main() {
	lint T;
	cin >> T;

	rep(_, T) {
		lint N, X;
		cin >> N >> X;
		lint a=0, b=0, c=0, x, y, z;
		if (X%2 == 1) std::cout << ((N+1)/2)%998244353 << '\n';
		else {
			a = (N/(2*X+2))*(X+2);
			x = N%(2*X+2);
			if (x < X) a += (x+1)/2;
			else a += x/2+1;
			std::cout << a%998244353 << '\n';
		}
	}
}
0