1 条题解

  • 1
    @ 2022-7-20 21:30:44
    #include<cstdio>
    #include<set>/*用 set 是为了防止重复答案,如果用数组然后 unique 去重也可以*/
    typedef long long ll;//不开 long long 见祖宗
    std::set<ll> s;
    int main(){
    	ll n;
    	scanf("%lld",&n);
    	if(n==1){puts("None");return 0;}//无解
    	puts("1");
    	for(register ll i=1;i*i<=n;i++)//枚举 a
    		if(n%i==0){//如果满足条件(可以整除)
    			ll a=i,b=n/a;
    			for(register ll j=b+1;j<=n;j+=b)if((j+1)%i==0)s.insert(j);
    			for(register ll j=b-1;j<=n;j+=b)if((j-1)%i==0)s.insert(j);
    		}
    	for(std::set<ll>::iterator it=s.begin();it!=s.end();it++)printf("%lld\n",*it);//用指针输出比较方便
    	return 0;
    }
    
    • 1

    信息

    ID
    3227
    时间
    1000ms
    内存
    125MiB
    难度
    5
    标签
    递交数
    1
    已通过
    1
    上传者