結果
問題 | No.2176 LRM Question 1 |
ユーザー |
![]() |
提出日時 | 2024-12-02 18:38:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 2,138 ms |
コンパイル使用メモリ | 192,052 KB |
最終ジャッジ日時 | 2025-02-26 10:38:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ll l, r, m; cin >> l >> r >> m;if(l >= m){cout << 0 << endl;return 0;}if(r >= m){r = m - 1;}ll a = 1, b = 1;ll ans = 0;for(int i = 1; i < r + 1; ++i){a = (a * i) % m;b = (b * a) % m;if(i < l){continue;}ans = (ans + b) % m;}cout << ans << endl;return 0;}