結果

問題 No.889 素数!
ユーザー betrue12
提出日時 2019-09-20 21:41:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 1,588 ms
コンパイル使用メモリ 167,444 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 16:59:47
合計ジャッジ時間 3,124 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void fin(string S){
    cout << S << endl;
    exit(0);
}

int main() {
    int N;
    cin >> N;
    
    if(N <= 1){
        cout << N << endl;
        return 0;
    }
    bool prime = true;
    for(int i=2; i<N; i++) if(N%i == 0) prime = false;
    if(prime) fin("Sosu!");

    int a = round(pow(N, 0.5));
    if(a*a == N) fin("Heihosu!");
    a = round(pow(N, 0.33333));
    if(a*a*a == N) fin("Ripposu!");
    if(N == 6 || N == 28) fin("Kanzensu!");
    cout << N << endl;
    return 0;
}
0