結果
| 問題 |
No.2474 Empty Quartz
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-23 21:08:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 747 bytes |
| コンパイル時間 | 1,600 ms |
| コンパイル使用メモリ | 166,788 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-16 20:57:48 |
| 合計ジャッジ時間 | 5,837 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 1 TLE * 1 -- * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const ll mod=998244353;
const int iu=1e5;
ll n,m;
ll f[iu+1],inf[iu+1];
ll pw(ll x,ll y){
if(y==0) return 1;
if(y%2) return x*pw(x,y-1)%mod;
ll res=pw(x,y/2);
return res*res%mod;
}
ll C(ll x,ll y){
return f[x]*inf[y]%mod*inf[x-y]%mod;
}
ll solve(){
ll ans=0;
for(int k=1; k<=n ;k++){//no of 1
ll res=k*(n-k+1);
if(res!=m) continue;
ans=(ans+C(n,k))%mod;
}
return ans;
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);
f[0]=1;
for(int i=1; i<=iu ;i++) f[i]=f[i-1]*i%mod;
inf[iu]=pw(f[iu],mod-2);
for(int i=iu; i>=1 ;i--) inf[i-1]=inf[i]*i%mod;
int t;cin >> t;
while(t--){
cin >> n >> m;
cout << solve() << '\n';
}
}