結果
| 問題 |
No.889 素数!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-27 20:48:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 987 bytes |
| コンパイル時間 | 3,734 ms |
| コンパイル使用メモリ | 229,188 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-02 18:03:58 |
| 合計ジャッジ時間 | 5,158 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
using ll = long long;
int n;
bool is_prime(ll x){
for(int i=2;i*i<=x;i++)if(x%i==0) return false;
return true;
}
bool is_square_number(ll x){
for(int i=1;i*i<=x;i++)if(i*i==x) return true;
return false;
}
bool is_cubic_number(ll x){
for(int i=1;i*i*i<=x;i++)if(i*i*i==x) return true;
return false;
}
int main () {
cin.tie(0); ios::sync_with_stdio(false);
cin >> n;
if(n<=1) cout << n << '\n';
else if(is_prime(n)) cout << "Sosu!" << '\n';
else if(is_square_number(n)) cout << "Heihosu!" << '\n';
else if(is_cubic_number(n)) cout << "Ripposu!" << '\n';
else if(n==6 || n==28) cout << "Kanzensu!" << '\n';
else cout << n << '\n';
}