結果

問題 No.2206 Popcount Sum 2
コンテスト
ユーザー vjudge1
提出日時 2026-05-12 17:38:40
言語 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  
実行時間 -
コード長 762 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,336 ms
コンパイル使用メモリ 210,724 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2026-05-12 17:39:15
合計ジャッジ時間 8,614 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_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;
#pragma GCC optimize(2)
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[400005]={1},inv[400005]={1};
long long c(int a,int b){
	return fc[a]*inv[b]%mod*inv[a-b]%mod;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	for(int i=1;i<=4e5;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;
		//ans=(ans+s*qpow(m,n))%mod;
		for(int i=1;i<=m;i++){
			ans=(ans+c(n-1,i-1)*s)%mod;
		}
		cout<<ans<<endl;
	}
	return 0;
}/*
(n-1)!/(1)!/(n-2)!
?n???????<=m???? 
*/
0