結果

問題 No.645 Count Permutation
ユーザー e869120e869120
提出日時 2018-02-02 22:45:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 64,024 KB
実行使用メモリ 53,652 KB
最終ジャッジ日時 2023-08-30 02:21:04
合計ジャッジ時間 8,617 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
53,368 KB
testcase_01 WA -
testcase_02 AC 186 ms
53,320 KB
testcase_03 AC 186 ms
53,360 KB
testcase_04 WA -
testcase_05 AC 186 ms
53,372 KB
testcase_06 AC 189 ms
53,424 KB
testcase_07 AC 188 ms
53,600 KB
testcase_08 WA -
testcase_09 AC 186 ms
53,652 KB
testcase_10 AC 187 ms
53,324 KB
testcase_11 AC 186 ms
53,324 KB
testcase_12 AC 187 ms
53,440 KB
testcase_13 AC 189 ms
53,324 KB
testcase_14 AC 186 ms
53,360 KB
testcase_15 WA -
testcase_16 AC 188 ms
53,428 KB
testcase_17 AC 188 ms
53,444 KB
testcase_18 AC 189 ms
53,320 KB
testcase_19 AC 190 ms
53,364 KB
testcase_20 AC 188 ms
53,436 KB
testcase_21 WA -
testcase_22 AC 187 ms
53,368 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 189 ms
53,340 KB
testcase_26 AC 186 ms
53,328 KB
testcase_27 AC 187 ms
53,364 KB
testcase_28 AC 187 ms
53,372 KB
testcase_29 AC 187 ms
53,316 KB
testcase_30 AC 186 ms
53,340 KB
testcase_31 AC 185 ms
53,320 KB
testcase_32 AC 187 ms
53,432 KB
testcase_33 AC 188 ms
53,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

long long dp[100009][64], mod = 1000000007;

int main() {
	dp[0][0] = 1;
	for (int i = 0; i < 100008; i++) {
		for (int j = 0; j < 63; j++) {
			dp[i + 1][j] += dp[i][j] * i; dp[i + 1][j] %= mod;
			dp[i + 1][j + 1] += dp[i][j]; dp[i + 1][j + 1] %= mod;
		}
	}
	long long N, L, R, sum = 0; cin >> N >> L >> R;
	for (int i = 0; i < 61; i++) {
		if (L <= (1LL << i) && (1LL << i) <= R) {
			sum += dp[N - 1][i]; sum %= mod;
		}
	}
	cout << sum << endl;
	return 0;
}
0