随笔分类 - 数论
摘要:problem给出正整数n和k计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值solutionk (n−k)∗k(n−k)∗k。k = i,对答案贡献为0。k > i,贡献为∑ (k - ⌊k/i⌋*i) ,⌊...
阅读全文
摘要:problemsolutioncodes#includeusing namespace std;typedef long long LL;int main(){ LL a, b; cin>>a>>b; cout<<a*b-a-b<<"\n"; re...
阅读全文
摘要:problemsolutioncodes#includeusing namespace std;typedef long long LL;LL exgcd(LL a, LL b, LL &x, LL &y){ if(!b){ x = 1, y = ...
阅读全文