結果

問題 No.3457 Fibo-shrink
コンテスト
ユーザー umezo
提出日時 2026-03-02 02:24:44
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 672 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,080 ms
コンパイル使用メモリ 380,504 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-03-02 02:24:52
合計ジャッジ時間 5,832 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint=static_modint<10007>;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll k,s,n;
  cin>>k>>s>>n;
  V<mint> F(k+2);
  F[0]=1,F[1]=1;
  for(int i=2;i<=k+1;i++) F[i]=F[i-1]+F[i-2];
  V<mint> A(n+1);
  A[1]=s;
  for(int i=2;i<=n;i++){
    for(int j=1;j<=k+1;j++){
      if(i-j<=0) break;
      A[i]+=A[i-j]/F[j-1];
    }
  }
  cout<<A[n].val()<<endl;
    
  return 0;
}
0