結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2019-09-27 23:13:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 688 bytes |
コンパイル時間 | 1,475 ms |
コンパイル使用メモリ | 169,284 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 01:39:44 |
合計ジャッジ時間 | 3,109 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 WA * 18 |
ソースコード
#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); if(is_prime(N))ans = "Sosu!"; else if(N != 1 && sqrt(N) * sqrt(N) == 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; }