結果
| 問題 | 
                            No.889 素数!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mmn15277198
                         | 
                    
| 提出日時 | 2020-07-05 18:29:34 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,061 bytes | 
| コンパイル時間 | 773 ms | 
| コンパイル使用メモリ | 80,072 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 16:54:47 | 
| 合計ジャッジ時間 | 2,273 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 59 WA * 2 | 
ソースコード
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>
#include <map>
using namespace std;
bool is_prime(long long x){
	bool res=true;
	if(x==1)res=false;
	
	for(long long i=2;i*i<=x;i++){
		if(x%i==0){
			res=false;
			return res;
		}
	}
	return res;
}
bool is_rippo(long long x){
	bool res=false;
	if(x==1)res=false;
	
	for(long long i=2;i*i*i<=x;i++){
		if(i*i*i==x){
			res=true;
			return res;
		}
	}
	return res;
}
bool is_kanzen(long long x){
	bool res=false;
	if(x==1)res=false;
	long long sum=1;
	for(long long i=2;i*i<=x;i++){
		if(x%i==0){
			sum+=i;
			if(x/i==i)continue;
			sum+=x/i;
		}
	}
	if(sum==x){
		res=true;
	}
	return res;
}
int main(){
	int n;
	cin >> n;
	
	if(is_prime(n)){
		cout << "Sosu!" << endl;
		return 0;
	}
	
	int temp=sqrt(n);
	if(temp*temp==n){
		cout << "Heihosu!" << endl;
		return 0;
	}
	
	if(is_rippo(n)){
		cout << "Ripposu!" << endl;
		return 0;
	}
	
	if(is_kanzen(n)){
		cout << "Kanzensu!" << endl;
		return 0;
	}
	
	cout << n << endl;
	
	return 0;
}
            
            
            
        
            
mmn15277198