結果
問題 | No.612 Move on grid |
ユーザー | yuppe19 😺 |
提出日時 | 2017-12-12 19:25:21 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 756 bytes |
コンパイル時間 | 456 ms |
コンパイル使用メモリ | 66,296 KB |
最終ジャッジ日時 | 2023-08-22 22:14:45 |
合計ジャッジ時間 | 837 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:27: error: ‘powl’ was not declared in this scope constexpr int mod = int(powl(10, 9)) + 7; ^~~~ main.cpp:7:27: note: suggested alternative: ‘bool’ constexpr int mod = int(powl(10, 9)) + 7; ^~~~ bool
ソースコード
#include <iostream> #include <algorithm> #include <unordered_map> using namespace std; int main(void) { constexpr int mod = int(powl(10, 9)) + 7; int T; scanf("%d", &T); int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); unordered_map<int, int> dp, ndp; dp[0] = 1; for(int t=0; t<T; ++t) { ndp.clear(); for(auto&& kv : dp) { int cur = kv.first; (ndp[cur + a] += dp[cur]) %= mod; (ndp[cur - a] += dp[cur]) %= mod; (ndp[cur + b] += dp[cur]) %= mod; (ndp[cur - b] += dp[cur]) %= mod; (ndp[cur + c] += dp[cur]) %= mod; (ndp[cur - c] += dp[cur]) %= mod; } dp = ndp; } int res = 0; for(int r=d; r<=e; ++r) { (res += dp[r]) %= mod; } printf("%d\n", res); return 0; }