結果
| 問題 | 
                            No.889 素数!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-06-24 21:57:59 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 861 bytes | 
| コンパイル時間 | 1,047 ms | 
| コンパイル使用メモリ | 138,164 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-30 18:46:23 | 
| 合計ジャッジ時間 | 2,298 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 60 WA * 1 | 
ソースコード
#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==1 || 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>1 && n == (int)sqrt(n) * (int)sqrt(n)) cout << "Heihosu!" << endl;
    else if (n>1 && n == (int)cbrt(n) * (int)cbrt(n) * (int)cbrt(n)) cout << "Ripposu!" << endl;
    else if (n!=0 && add_div(n) == n) cout << "Kanzensu!" << endl;
    else cout << n << endl;
}