結果

問題 No.889 素数!
ユーザー trineutron
提出日時 2019-09-16 15:18:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 878 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 172,104 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 02:23:29
合計ジャッジ時間 2,955 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
    vector<int> prime, square, cube, perfect = { 6, 28 };
    for (int i = 2; i < 64; i++) {
        if (i * i < 64) square.push_back(i * i);
        if (i * i * i < 64) cube.push_back(i * i * i);
        if (i == 2 || i == 3 || i == 5 || i == 7 || i % 2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7 != 0) prime.push_back(i);
    }
    int n;
    cin >> n;
    if (find(prime.begin(), prime.end(), n) != prime.end()) {
        cout << "Sosu!" << endl;
    } else if (find(square.begin(), square.end(), n) != square.end()) {
        cout << "Heihosu!" << endl;
    } else if (find(cube.begin(), cube.end(), n) != cube.end()) {
        cout << "Ripposu!" << endl;
    } else if (find(perfect.begin(), perfect.end(), n) != perfect.end()) {
        cout << "Kanzensu!" << endl;
    } else {
        cout << n << endl;
    }
}
0