diff --git a/TangDou/Topic/SpareTire.cpp b/TangDou/Topic/SpareTire.cpp index 5899380..e4d0559 100644 --- a/TangDou/Topic/SpareTire.cpp +++ b/TangDou/Topic/SpareTire.cpp @@ -3,9 +3,9 @@ using namespace std; #define int long long #define endl "\n" const int maxn = 10000; -const int Six = 166666668; /// 6,2关于mod的乘法逆元 +const int Six = 166666668; // 6,2关于mod的乘法逆元 const int Two = 500000004; -const int mod = 1e9 + 7; /// 尽量这样定义mod ,减少非必要的麻烦 +const int mod = 1e9 + 7; // 尽量这样定义mod ,减少非必要的麻烦 int Mod(int a, int b) { return (a % mod) * (b % mod) % mod; @@ -13,7 +13,7 @@ int Mod(int a, int b) { // 递推函数可以用通项式直接求解 // 通项式:a[kn]=(k*n)^2+k*n -int F(int k, int n) { +int F(int k, int n) { return (Mod(k, k) * Mod(Mod(n, n + 1), Mod(n + n + 1, Six)) % mod + Mod(Mod(1 + n, n), Mod(k, Two))) % mod; } @@ -50,7 +50,7 @@ signed main() { } if (num & 1) - ans = (ans + F(x, n / x)) % mod; /// 根据容斥,取奇数个因子时,应加上 + ans = (ans + F(x, n / x)) % mod; // 根据容斥,取奇数个因子时,应加上 else ans = ((ans - F(x, n / x)) % mod + mod) % mod; }