結果

問題 No.889 素数!
ユーザー keisuke6
提出日時 2022-05-27 20:53:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 1,553 ms
コンパイル使用メモリ 166,420 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-20 15:23:42
合計ジャッジ時間 3,092 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
bool rippo(int N){
    for(int i=0;i*i*i<=N;i++)if(i*i*i==N) return true;
    return false;
}
bool heiho(int N){
    for(int i=0;i*i<=N;i++)if(i*i==N) return true;
    return false;
}
bool sosu(int N){
    for(int i=2;i*i<=N;i++)if(N%i == 0) return false;
    return true;
}
signed main(){
    int N;
    cin>>N;
    if(N <= 1) cout<<N<<endl;
    else if(N == 6 || N == 28) cout<<"Kanzensu!"<<endl;
    else if(rippo(N)) cout<<"Ripposu!"<<endl;
    else if(heiho(N)) cout<<"Heihosu!"<<endl;
    else if(sosu(N)) cout<<"Sosu!"<<endl;
    else cout<<N<<endl;
}
0