/ Randle /

记录详情

Runtime Error


  
# 状态 耗时 内存占用
#1 Wrong Answer 29ms 76.809 MiB
#2 Wrong Answer 30ms 76.797 MiB
#3 Wrong Answer 28ms 76.805 MiB
#4 Wrong Answer 33ms 76.812 MiB
#5 Wrong Answer 38ms 76.801 MiB
#6 Wrong Answer 29ms 76.801 MiB
#7 Runtime Error 41ms 76.812 MiB
#8 Runtime Error 50ms 76.812 MiB
#9 Runtime Error 38ms 76.797 MiB
#10 Runtime Error 36ms 76.812 MiB

代码

#include<bits/stdc++.h>
const int maxn=1e7;
inline const void read(long long &a)
{
	a=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
}
inline const void write(long long a)
{
	if(a>9)write(a/10);
	putchar(a%10+'0');
}
long long n,ans=0,sqrtn;
long long f[maxn];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	memset(f,0,sizeof(f));
	read(n);sqrtn=sqrt(n);
	for(int i=1;i<=sqrtn;i++)
	{
		f[i*i]--;
		for(int j=i;j*i<=n;j++)f[i*j]+=2;
	}
	for(int i=1;i<=n;i++)ans+=n/i*f[i];
	write(ans);
	return 0;
}

信息

递交者
类型
递交
题目
a*b的整除 T1
题目数据
下载
语言
C++
递交时间
2017-10-02 13:25:00
评测时间
2017-10-02 13:25:00
评测机
分数
0
总耗时
358ms
峰值内存
76.812 MiB