結果
問題 |
No.2807 Have Another Go (Easy)
|
ユーザー |
![]() |
提出日時 | 2024-07-17 01:58:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 3,000 ms |
コード長 | 810 bytes |
コンパイル時間 | 4,893 ms |
コンパイル使用メモリ | 309,848 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-07-17 01:58:16 |
合計ジャッジ時間 | 7,014 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair<int,int>; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,m,k;cin>>n>>m>>k; vc<mint>dp(2*n,0); dp[0]=1; rep(i,2*n)for(int j=1;j<=6;j++)if(i+j<2*n)dp[i+j]+=dp[i]; auto f=[&](int a)->mint{ mint res=0; int base=2*n-a-6; rep(i,6)if(base+i>=0){ res+=dp[base+i]*(1+i); } return res; }; rep(z,k){ int a;cin>>a; mint ans=dp[a]*f(a)+dp[a+n]*f(a+n)-dp[a]*dp[n]*f(a+n); cout<<ans.val()<<"\n"; } }