Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
984 B
1
Indexable
Never
#include <iostream>
#include<vector>
using namespace std;
bool prime[10001];
vector<int> primes;
void findprime(){ //建構質數表
    for (int i=0;i<10001;i++){//
        prime[i]=true;
    }
    prime[0]=false;
    prime[1]=false;
    for (int i=2; i<10001; i++){
            if (prime[i]){
              if((long long)i*i<10001){//
                for(int m=i*i; m<10001; m+=i)
                  prime[m] = false;
              }
              primes.push_back(i);//儲存已知的質數
        }
    }
  }

int main(){
    findprime();
    int n;
    while(cin>>n){
        if(n==0) break;
        int sum=0;
        for(int i=0;primes[i]<n;i++){
                if(n%primes[i]==0){
                    
                }
        }
        if(sum>n){
            cout<<"ABUNDANT";
        }
        else if(sum<n){
            cout<<"DEFICIENT";
        }
        else{
            cout<<"PERFECT";
        }
    }

   return 0;
}