# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1047533 | 12345678 | Savrsen (COCI17_savrsen) | C++17 | 53 ms | 131072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=1e7+5;
ll a, b, res, p[nx], dp[nx];
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>a>>b;
for (int i=1; i<=b; i++) dp[i]=1;
for (ll i=2; i<=b; i++)
{
if (p[i]) continue;
for (ll j=i; j<=b; j+=i)
{
p[j]=1;
ll tmp=1, mul=i;
while ((j%mul)==0) tmp+=mul, mul*=i;
dp[j]*=tmp;
}
}
//for (int i=1; i<=b; i++) cout<<"debug "<<dp[i]<<'\n';
for (int i=a; i<=b; i++) res+=abs(dp[i]-2*i);
cout<<res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |