結果
| 問題 | No.889 素数! |
| コンテスト | |
| ユーザー |
kya_ski
|
| 提出日時 | 2019-09-27 23:15:50 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 465µs | |
| コード長 | 696 bytes |
| 記録 | |
| コンパイル時間 | 940 ms |
| コンパイル使用メモリ | 182,388 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-03 16:11:37 |
| 合計ジャッジ時間 | 3,835 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
bool is_prime(int _Num){
if(_Num < 2)return false;
if(_Num % 2 == 0){
if(_Num == 2)return true;
else return false;
}
bool prime = true;
for(int i = 3; i <= sqrt(_Num); i += 2){
if(_Num % i == 0){
prime = false;
break;
}
}
return prime;
}
int main(){
int N;
cin >> N;
string ans = to_string(N);
int s = sqrt(N);
if(is_prime(N))ans = "Sosu!";
else if(N > 1 && s * s == N)ans = "Heihosu!";
else if(N == 8 || N == 27 || N == 64)ans = "Ripposu!";
else if(N == 6 || N == 28)ans = "Kanzensu!";
cout << ans << endl;
return 0;
}
kya_ski