結果
問題 | No.727 仲介人moko |
ユーザー | __dAi00 |
提出日時 | 2018-08-24 22:51:00 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 388 ms |
コンパイル使用メモリ | 52,052 KB |
実行使用メモリ | 9,888 KB |
最終ジャッジ日時 | 2023-09-05 12:56:14 |
合計ジャッジ時間 | 2,954 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
9,820 KB |
testcase_01 | AC | 2 ms
5,568 KB |
testcase_02 | AC | 8 ms
5,420 KB |
testcase_03 | TLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
ソースコード
#include <iostream> using namespace std; long long dp[2][1000007]; int main() { long long N; cin >> N; const long long MOD = 1000000007; for (long long i = 0; i <= N; i++) { if (i == 0) { dp[0][0] = 1; continue; } for (long long j = 0; j <= i; j++) { // i > 0 if (j == 0) { dp[i%2][j] = dp[(i+1)%2][j]; } else { dp[i%2][j] = (dp[(i+1)%2][j] + dp[i%2][j-1] * (i - (j-1))) % MOD; } } } long long Na = 1; for (int i = 1; i <= N; i++) Na = (Na * i) % MOD; cout << (((dp[N%2][N] * Na) % MOD) * Na) % MOD << endl; return 0; }