結果

問題 No.2176 LRM Question 1
ユーザー kpinkcatkpinkcat
提出日時 2023-09-24 15:33:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 197,664 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 15:33:36
合計ジャッジ時間 4,605 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;


int main()
{
    ll n, l, m, lim = 0, pro = 1, cumpro = 1, sum1 = 0;
    cin >> n >> l >> m;
    for (ll i = 1; i <= m; i++){
        pro *= i;
        if(!(pro%m)){
            lim = i;
            break;
        }
        pro %= m;
    }
    pro = 1;
    for (ll i = 1; i < lim; i++){
        pro *= i;
        cumpro *= pro;
        if (!(cumpro%m)) break;
        cumpro %= m;
        if (i >= n) sum1 += cumpro%m;
        sum1 %= m;
    }
    cout << sum1 << endl;
}
0