Submission #20379106
Source Code Expand
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<bitset>
#include<deque>
#include<cstdlib>
#include<set>
#include<ctime>
#define ll long long
#define N 200032
#define mp make_pair
using namespace std;
ll read()
{
ll x=0,f=1;
char c=getchar();
while(c>'9'||c<'0')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+c-'0';
c=getchar();
}
return f*x;
}
int n,m,cnt,st[N],mn[N],num[N];
ll as[N];
bool vis[N];
int main()
{
vis[1]=1;
as[1]=1;
n=read();
for(int i=2;i<=n;++i)
{
if(!vis[i]) st[++cnt]=i,as[i]=2,mn[i]=i,num[i]=i;
for(int j=1;j<=cnt&&st[j]*i<=n;++j)
{
vis[st[j]*i]=1;
if(i%st[j]==0)
{
mn[st[j]*i]=st[j];
num[st[j]*i]=num[i]*st[j];
as[st[j]*i]=as[i]+as[i/num[i]];
break;
}
else
{
mn[st[j]*i]=st[j];
num[st[j]*i]=st[j];
as[st[j]*i]=2*as[i];
}
}
}
ll tot=0,ans=0;
for(int i=1;i<=n;++i)
{
as[i]+=as[i-1];
}
for(int i=1;i<=n;++i){
int now=n/i;
ans+=as[now];
}
cout<<ans<<'\n';
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - A*B*C |
| User | MTS_zx |
| Language | C++ (Clang 10.0.0) |
| Score | 300 |
| Code Size | 1175 Byte |
| Status | AC |
| Exec Time | 14 ms |
| Memory | 6432 KiB |
Compile Error
./Main.cpp:63:5: warning: unused variable 'tot' [-Wunused-variable]
ll tot=0,ans=0;
^
1 warning generated.
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 14 ms | 6432 KiB |
| 02.txt | AC | 9 ms | 6324 KiB |
| 03.txt | AC | 8 ms | 5188 KiB |
| 04.txt | AC | 3 ms | 3740 KiB |
| 05.txt | AC | 2 ms | 2936 KiB |
| 06.txt | AC | 2 ms | 3032 KiB |
| 07.txt | AC | 10 ms | 6164 KiB |
| s1.txt | AC | 2 ms | 2948 KiB |
| s2.txt | AC | 2 ms | 3072 KiB |
| s3.txt | AC | 3 ms | 3520 KiB |