/ /

记录详情

Accepted

foo.cc: In function 'int main()':
foo.cc:7:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d%d",&a,&b);
 ~~~~~^~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Accepted 77ms 428.0 KiB
#2 Accepted 2ms 408.0 KiB
#3 Accepted 11ms 432.0 KiB
#4 Accepted 2ms 432.0 KiB
#5 Accepted 71ms 432.0 KiB
#6 Accepted 8ms 432.0 KiB
#7 Accepted 176ms 432.0 KiB
#8 Accepted 29ms 432.0 KiB
#9 Accepted 276ms 428.0 KiB
#10 Accepted 233ms 436.0 KiB

代码

#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
int ans_=0;
for(int i=a;i<=b;i++)
{
int ans=1;
for(int j=2;j*j<=i;j++)
{
if(i%j==0)
ans+=j+i/j;
}
if(ans<=i)continue;
int ans2=1;
for(int j=2;j*j<=ans;j++)
{
if(ans%j==0)
ans2+=j+ans/j;
}
if(ans2==i)
ans_+=1;
}
printf("%d",ans_);
}

信息

递交者
类型
递交
题目
P1005 亲和数
题目数据
下载
语言
C++
递交时间
2021-08-11 19:47:35
评测时间
2021-10-25 17:01:02
评测机
分数
100
总耗时
891ms
峰值内存
436.0 KiB