結果
問題 |
No.840 ほむほむほむら
|
ユーザー |
![]() |
提出日時 | 2019-03-26 01:45:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,011 bytes |
コンパイル時間 | 913 ms |
コンパイル使用メモリ | 100,096 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 05:11:03 |
合計ジャッジ時間 | 8,720 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 8 RE * 17 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pint; typedef pair<ll,int> pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ int n,k; cin>>n>>k; assert(n<=16); int mask=1; rep(i,n)mask*=3; int ans=0; rep(i,mask){ vector<int> v(n); int cur=i; rep(j,n){ v[j]=cur%3; cur/=3; } vector<int> dp(3); rep(j,n){ if(v[j]==0)dp[0]++; if(v[j]==1)dp[1]+=dp[0]; if(v[j]==2)dp[2]+=dp[1]; } if(dp[2]%k==0)ans++; } cout<<ans<<endl; return 0; }