牛客IOI周赛16-普及组 A 求导
求导
https://ac.nowcoder.com/acm/contest/5389/A
这题经过仔细的枚举,发现就是n的阶乘,于是瞬间打代码,错,结果是因为没有mod 1e+9 + 7,于是再打代码,对了,于是决定写题解。
代码:
#include<bits/stdc++.h>
using namespace std;
const unsigned long long mod=1e+9+7;
int n;long long s=1;
int main(){
cin>>n;
for(int i=1;i<=n;++i){s*=i;s%=mod;}
cout<<s<<endl;
return 0;
}
查看15道真题和解析