結果
問題 |
No.2206 Popcount Sum 2
|
ユーザー |
![]() |
提出日時 | 2025-08-02 16:30:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 2,999 ms |
コンパイル使用メモリ | 275,408 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-02 16:30:22 |
合計ジャッジ時間 | 14,717 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 TLE * 1 -- * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d",&test); | ~~~~~^~~~~~~~~~~~ main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; int test,n,m,fac[200010],inv[200010],inve[200010]; const int P=998244353; int main() { scanf("%d",&test); for(;test--;) { scanf("%d%d",&n,&m); fac[0]=fac[1]=inv[1]=inve[0]=inve[1]=1; for(int i=2;i<=n;i++) { fac[i]=1LL*fac[i-1]*i%P; inv[i]=1LL*(P-P/i)*inv[P%i]%P; inve[i]=1LL*inve[i-1]*inv[i]%P; } int sum=0; for(int i=0;i<m;i++) sum=(sum+1LL*fac[n-1]*inve[i]%P*inve[n-i-1]%P)%P; int ans=1; for(int i=1;i<=n;i++) ans=ans*2%P; ans=(ans-1+P)%P; printf("%lld\n",1LL*sum*ans%P); } return 0; }