結果

問題 No.889 素数!
ユーザー zeronosu77108
提出日時 2020-06-24 21:56:23
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 831 bytes
コンパイル時間 937 ms
コンパイル使用メモリ 139,184 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-30 18:45:58
合計ジャッジ時間 2,614 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 58 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <climits>
#include <map>
#include <queue>
#include <cmath>

using namespace std;

using int64 = long long;

bool isPrime(const int& n) {
    if (n%2==0) return false;
    for (int i=3; i*i<=n; i++) {
        if (n%i==0) return false;
    }
    return true;
}

int add_div(const int& n) {
    int res = 0;
    for (int i=1; i<n; i++) {
        if (n%i==0) res += i;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    if (isPrime(n)) cout << "Sosu!" << endl;
    else if (n == (int)sqrt(n) * (int)sqrt(n)) cout << "Heihosu!" << endl;
    else if (n == (int)cbrt(n) * (int)cbrt(n) * (int)cbrt(n)) cout << "Ripposu!" << endl;
    else if (add_div(n) == n) cout << "Kanzensu!" << endl;
    else cout << n << endl;
}
0