/ Randle /

记录详情

Compile Error

/tmp/ccUHdSFv.o: In function `main':
foo.cc:(.text.startup+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x89): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0xbf): relocation truncated to fit: R_X86_64_PC32 against symbol `sqrtn' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccUHdSFv.o
foo.cc:(.text.startup+0x16a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUHdSFv.o
/tmp/ccUHdSFv.o: In function `_GLOBAL__sub_I_n':
foo.cc:(.text.startup+0x183): relocation truncated to fit: R_X86_64_PC32 against `.bss'
foo.cc:(.text.startup+0x1a1): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status

代码

#include<bits/stdc++.h>
const int maxn=1e9;
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 16:41:16
评测时间
2017-10-02 16:41:16
评测机
分数
0
总耗时
1580ms
峰值内存
135.172 MiB