P9707 [KMOI R1] 音波武器 tj
_colin1112_ · · 题解
思路
从
当
AC Code
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const int E=1e6+5;
ll l,r,k,ans=1,max1=LONG_LONG_MIN;
int main(){
cin >>l>>r>>k;
for(int i=1;i<=r;i++){
ans=(ans%k*i%k)%k;
if(i>=l){
max1=max(max1,ans);
}
}
cout <<max1;
return 0;
}