結果

問題 No.1186 長方形の敷き詰め
ユーザー DaYuanChi
提出日時 2021-01-26 20:42:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 174,512 KB
実行使用メモリ 144,256 KB
最終ジャッジ日時 2024-06-23 19:06:27
合計ジャッジ時間 5,655 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll a[1000005];
map<ll, int> memo;
ll const mod = 1e9+7;

int n, m;

ll f(int i){
  if(memo.find(i)!=memo.end()) return memo[i];
  if(i<=n-1) return memo[i] = 1;
  else return memo[i] = (f(i-1)+f(i-n))%mod;
}


int main(){
  cin >> n >> m;
  if(n > m){
    cout << 1 << endl;
    return 0;
  }
  if(n <= m){
    cout << f(m) << endl;
    return 0;
  }
}
0