結果

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

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int t,m,n;
long long qpow(long long a,long long b){
	if(b==0)return 1;
	if(b==1)return a;
	long long t=qpow(a,b/2);
	return t*t%mod*qpow(a,b%2)%mod;
}long long fc[200005]={1},inv[200005]={1};
long long c(int a,int b){
	return fc[a]*inv[b]%mod*inv[a-b]%mod;
}
int main(){
	for(int i=1;i<=2e5;i++)fc[i]=fc[i-1]*i%mod,inv[i]=qpow(fc[i],mod-2);
	cin>>t;
	while(t--){
		cin>>n>>m;
		long long s=qpow(2,n),tmp=qpow(n,mod-2),ans=0;
		s=(s+mod-1)%mod;
		for(int i=1;i<=m;i++){
			long long t=c(n,i);
			t=t*tmp%mod*i%mod;
			ans=(ans+t*s)%mod;
		}cout<<ans<<endl;
	}
	return 0;
}
0