結果
問題 | No.2176 LRM Question 1 |
ユーザー | CleyL |
提出日時 | 2023-01-06 21:31:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 1,754 bytes |
コンパイル時間 | 970 ms |
コンパイル使用メモリ | 111,164 KB |
実行使用メモリ | 18,768 KB |
最終ジャッジ日時 | 2023-08-20 14:33:17 |
合計ジャッジ時間 | 2,502 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 47 ms
18,532 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 32 ms
18,680 KB |
testcase_05 | AC | 4 ms
4,376 KB |
testcase_06 | AC | 3 ms
4,376 KB |
testcase_07 | AC | 3 ms
4,376 KB |
testcase_08 | AC | 33 ms
18,568 KB |
testcase_09 | AC | 31 ms
18,216 KB |
testcase_10 | AC | 41 ms
16,100 KB |
testcase_11 | AC | 2 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 32 ms
18,472 KB |
testcase_14 | AC | 48 ms
18,768 KB |
testcase_15 | AC | 38 ms
15,652 KB |
testcase_16 | AC | 31 ms
13,160 KB |
testcase_17 | AC | 3 ms
4,376 KB |
testcase_18 | AC | 29 ms
17,252 KB |
testcase_19 | AC | 21 ms
12,576 KB |
testcase_20 | AC | 9 ms
6,448 KB |
testcase_21 | AC | 21 ms
9,240 KB |
testcase_22 | AC | 4 ms
4,380 KB |
testcase_23 | AC | 19 ms
8,448 KB |
testcase_24 | AC | 16 ms
9,556 KB |
ソースコード
//yukicoder@cpp17 #include <iostream> #include <cmath> #include <algorithm> #include <iomanip> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #include <map> #include <bitset> #include <complex> #include <cctype> #include <utility> #include <climits> #include <numeric> using namespace std; using ll = long long; using P = pair<ll,ll>; const ll MOD = 998244353; const ll MODx = 1000000007; const int INF = (1<<30)-1; const ll LINF = (1LL<<62LL)-1; const double EPS = (1e-10); P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}}; P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}}; template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); } template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); } /* 確認ポイント cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる 計算量は変わらないが楽できるシリーズ min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる */ /* function corner below */ /* Function corner above */ /* comment outed because can cause bugs __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } */ int main(){ long long l,r,m;cin>>l>>r>>m; long long ans = 0; long long nw = 1; vector<long long> k(m); vector<long long> k2(m); k[1] = k2[1] = 1; for(long long i = 2; m > i; i++){ k[i] = (k[i-1]*i)%m; k2[i] = (k2[i-1]*k[i])%m; } for(long long i = l; min(m,r+1) > i; i++){ ans = (k2[i]+ans)%m; } cout << ans << endl; }