我不理解了我不就是取了亿点模然后样例都超时了
查看原帖
我不理解了我不就是取了亿点模然后样例都超时了
1050501
ATION001楼主2024/8/29 09:45

QAQ,求助大佬。

代码

#include<bits/stdc++.h>
using namespace std;
#define int __int128
const int mod=1e9+7;
inline int read()
{
    int x=0,f=1;
    char ch=cin.get();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
        x=x*__int128(10)+ch-'0',ch=cin.get();
    return x*f;
}
void print(__int128 x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+'0');
}
int n=1;
signed main(){
    for(int m=read();m;m--){
        int tot=read();
        n=(n*(tot)%mod)%mod;
    }
    for(int i=2;i<n;i++){
        if(n%i==0){
            n=(n*(i)%mod)%mod;
        }
    }
    print(n);
    return 0;
}
2024/8/29 09:45
加载中...