Help
查看原帖
Help
278259
RemiliaScar1et楼主2021/3/21 20:43

WA第五个点

不知道是哪里炸了qwq。

提交记录:record

code

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;

int main()
{
	ll n;
	cin>>n;
	ll res=n;
	for(ll i=2;i<=n/i;++i)
	{
		if(n%i==0)
		{
			ll a=0,p=i;
			while(n%p==0) ++a,n/=p;
			res=res*(p+(ll)a*p-a)/p;//算答案
		}
	}
	if(n>1) res=res*((ll)n+n-1)/n;
	cout<<res;
	return 0;
}
2021/3/21 20:43
加载中...