結果
| 問題 | No.3394 Big Binom |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-12 15:51:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 754 bytes |
| 記録 | |
| コンパイル時間 | 2,751 ms |
| コンパイル使用メモリ | 275,896 KB |
| 実行使用メモリ | 16,204 KB |
| 最終ジャッジ日時 | 2025-12-12 15:51:53 |
| 合計ジャッジ時間 | 6,493 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 OLE * 1 -- * 1 |
| other | -- * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%lld",&t);
| ~~~~~^~~~~~~~~~~
main.cpp:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
34 | scanf("%lld%lld",&n,&m);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn=200005;
const ll mod=998244353;
ll s[maxn+5],p[maxn+5];
ll qmksm(ll a,ll b){
ll ans,i,j,k;
ans=1;
while(b){
if(b&1) ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
void init(){
ll i,j,k;
s[0]=1;
for(i=1;i<=maxn;i++) s[i]=s[i-1]*i%mod;
p[maxn]=qmksm(s[maxn],mod-2);
for(i=maxn-1;i>=0;i--) p[i]=p[i+1]*(i+1)%mod;
}
ll cal(ll n,ll m){
ll zc,i,j,k;
if(m<0 or m>n) return 0;
return s[n]*p[m]%mod*p[n-m]%mod;
}
int main(){
ll n,m,t,ans,i,j,k;
init();
scanf("%lld",&t);
while(t--){
scanf("%lld%lld",&n,&m);
ans=cal(n,m);
printf("%lld\n",ans);
}
return 0;
}