結果
| 問題 |
No.1126 SUM
|
| ユーザー |
merom686
|
| 提出日時 | 2020-07-24 22:18:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 585 bytes |
| コンパイル時間 | 830 ms |
| コンパイル使用メモリ | 92,700 KB |
| 最終ジャッジ日時 | 2025-01-12 05:08:21 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
constexpr int P = 1000000007;
int main() {
int n, m;
cin >> n >> m;
int k = m - n + 1;
vector<int> x(k);
x[1] = 1;
for (int i = 2; i < k; i++) {
x[i] = P - (P / i * (ll)x[P % i] % P);
}
ll t = 1, s = t;
for (int i = 1; i < k; i++) {
t = t * (i + n) % P * x[i] % P;
s += t;
if (s >= P) s -= P;
}
cout << s << endl;
return 0;
}
merom686