标签:xiaomi als set inter answer min http studying script
求逆元的几种方法:https://blog.csdn.net/xiaoming_p/article/details/79644386
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<queue> #include<stack> #include<set> #include<vector> #include<map> #include<cmath> const int maxn=1e5+5; const long long mod=1e9+7; typedef long long ll; using namespace std; ll ksm(ll x,ll y) { ll ans=1; while(y) { if(y&1) ans=ans*x%mod; y>>=1; x=x*x%mod; } return ans; } int main() { ll n; while(cin>>n) { ll p=(n+1)*n/2; ll q=n*n; printf("%lld\n",(p*ksm(q,mod-2))%mod); } return 0; }
标签:xiaomi als set inter answer min http studying script
原文地址:https://www.cnblogs.com/Staceyacm/p/11221390.html