結果
問題 | No.612 Move on grid |
ユーザー |
|
提出日時 | 2021-04-02 23:47:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 145 ms / 2,500 ms |
コード長 | 765 bytes |
コンパイル時間 | 2,943 ms |
コンパイル使用メモリ | 192,752 KB |
最終ジャッジ日時 | 2025-01-20 10:10:28 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;const int MOD = 1e9 + 7;const int ZERO = 35000;int dp[501][70000];int main() {ios_base::sync_with_stdio(0);cin.tie(0);int T, a, b, c, d, e;cin >> T >> a >> b >> c >> d >> e;dp[0][ZERO] = 1;for (int t = 0; t < T; t++) {for (int i = 0; i < 70000; i++) {if (dp[t][i]) {(dp[t+1][i-a] += dp[t][i]) %= MOD;(dp[t+1][i+a] += dp[t][i]) %= MOD;(dp[t+1][i-b] += dp[t][i]) %= MOD;(dp[t+1][i+b] += dp[t][i]) %= MOD;(dp[t+1][i-c] += dp[t][i]) %= MOD;(dp[t+1][i+c] += dp[t][i]) %= MOD;}}}int ret = 0;for (int i = d; i <= e; i++) {ret += dp[T][i+ZERO];ret %= MOD;}cout << ret << endl;return 0;}