結果
| 問題 | No.2176 LRM Question 1 | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2023-01-06 21:26:06 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 537 bytes | 
| コンパイル時間 | 3,691 ms | 
| コンパイル使用メモリ | 251,816 KB | 
| 最終ジャッジ日時 | 2025-02-09 23:37:05 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 WA * 1 | 
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 2000000000000000005
int main(){
	
	long long L,R,M;
	cin>>L>>R>>M;
	
	mint::set_mod(M);
	
	mint cur = 1;
	mint ans = 0;
	mint mul = 1;
	long long cc = L;
	for(int i=1;i<=M;i++){
		cur *= i;
		mul *= cur;
		if(cc%M==i){
			ans += mul;
			cc++;
			if(cc>R)break;
		}
	}
	
	cout<<(ans).val()<<endl;
	
    return 0;
}
            
            
            
        