結果
問題 | No.889 素数! |
ユーザー |
|
提出日時 | 2019-09-21 15:51:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 1,483 ms |
コンパイル使用メモリ | 157,532 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 00:20:29 |
合計ジャッジ時間 | 3,304 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n = 0; cin >> n; bool sosuflag = true; bool hehoflag = false; bool rippoflag = false; int sum = 1; if(n == 1 || n == 0) sosuflag = false; for (int i = 2; i < n; i++){ if(n % i == 0){ sosuflag = false; sum += i; if(i*i == n){ hehoflag = true; }else if(i*i*i == n){ rippoflag = true; } } } if(sosuflag){ cout << "Sosu!"; }else if(hehoflag){ cout << "Heihosu!"; }else if(rippoflag){ cout << "Ripposu!"; }else if(sum != 0 && sum != 1 && sum == n){ cout << "Kanzensu!"; }else{ cout << n; } }