結果

問題 No.2206 Popcount Sum 2
コンテスト
ユーザー vjudge1
提出日時 2026-06-11 15:53:38
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 870 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,170 ms
コンパイル使用メモリ 330,688 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2026-06-11 15:54:10
合計ジャッジ時間 9,019 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5+5, mod = 998244353;
int n, m, fac[N], inv[N], inv2[N];
int qpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res *= a, res %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return res;
}
void Init() {
	fac[0] = inv[0] = 1;
	for (int i = 1; i <= N - 5; i++) fac[i] = fac[i - 1] * i % mod;
	inv[N - 5] = qpow(fac[N - 5], mod - 2);
	for (int i = N - 5; i >= 1; i--) inv[i - 1] = inv[i] * i % mod;
}
int C(int n, int m) {
	if (m == 0) return 1;
	return fac[n] * inv[m] % mod*inv[n - m] % mod;
}
void solve() {
	cin >> n >> m;
	int ans = 0;
	for (int i = 0; i <= m - 1; i++) {
		ans += C(n - 1, i);
		ans %= mod;
	}
	cout << ans*(qpow(2, n) - 1) % mod << "\n";
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	Init();
	int T;
	cin >> T;
	while (T--) solve();
	return 0;
}
0