不可摸数标识符的放置!

#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;
int T,n;
int ans=0;
int dp[5000]={0};
int main()
{
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<5000;i++)
    {
        dp[i]=0;
        for(int j=1;j<=i/2;j++)
        {
            if(!(i%j))
            {
                dp[i]+=j;
            }
        }
    }
    cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=0;i<=1000;i++)
        {
            if(dp[i]==n)
            {
               ans=1;
               break;
            }
        }
        if(ans==0)
        {
            cout<<"yes";
        }
        else
        {
            cout<<"no";
        }
        cout<<endl;
    }
}


Description

s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何 
数m,s(m)都不等于n,则称n为不可摸数. 
 

Input

包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2<=n<=1000)是整数。
 

Output

如果n是不可摸数,输出yes,否则输出no
 

Sample Input

 
    
3 2 5 8
 

Sample Output

 
    
yes yes

no

标识符要放循环外!!!

天坑!!!!!!!!!!!!!!!!!

猜你喜欢

转载自blog.csdn.net/qq1013459920/article/details/80994144