結果
問題 | No.2176 LRM Question 1 |
ユーザー |
![]() |
提出日時 | 2023-01-06 21:26:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 1,711 ms |
コンパイル使用メモリ | 193,576 KB |
最終ジャッジ日時 | 2025-02-09 23:37:13 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long f[1001001]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long L,R; int M; cin >> L >> R >> M; long long tmp = 1; f[0] = 1; for(int i = 1; i <= M; i++) { tmp = tmp*i%M; f[i] = (f[i-1]*tmp)%M; } long long ans = 0; for(long long i = L; i <= min(R,(long long)M); i++) { ans += f[i]; ans %= M; } cout << ans << endl; }