結果

問題 No.889 素数!
ユーザー kpinkcat
提出日時 2023-08-23 10:02:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 101,172 KB
最終ジャッジ日時 2025-02-16 12:30:49
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 60 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int n, sum1 = 0, f = 0;
    cin >> n;
    int t = pow(n, 0.5);
    for (int i = 2; i <= t; i++){
        if (n == i*i*i){
            cout << "Ripposu!" << endl;
            return 0;
        }
        if (n == i*i){
            cout << "Heihosu!" << endl;
            return 0;
        }
        if (n != 1 && !(n%i)) f++;
        if (!(n%i)){
            if (i != n/i) sum1 += (i + n/i);
            else sum1 += i;
        } 
    }
    sum1 += 1;
    if (n != 0 && sum1 == n){
        cout << "Kanzensu!" << endl;
        return 0;
    }
    if (n != 0 && n != 1 && !f) cout << "Sosu!" << endl;
    else cout << n << endl;
}
0