結果
| 問題 |
No.889 素数!
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2020-07-05 18:32:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,106 bytes |
| コンパイル時間 | 791 ms |
| コンパイル使用メモリ | 80,356 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 17:00:42 |
| 合計ジャッジ時間 | 2,376 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#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==0 || 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;
return res;
}
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 && n!=0 && n!=1){
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