結果
| 問題 | No.2206 Popcount Sum 2 |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-02 16:27:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 568 bytes |
| 記録 | |
| コンパイル時間 | 3,398 ms |
| コンパイル使用メモリ | 275,524 KB |
| 実行使用メモリ | 12,704 KB |
| 最終ジャッジ日時 | 2025-08-02 16:27:16 |
| 合計ジャッジ時間 | 14,773 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 3 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[100010],inve[100010];
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;
}
vjudge1