結果
| 問題 |
No.889 素数!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-21 15:50:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 767 bytes |
| コンパイル時間 | 1,281 ms |
| コンパイル使用メモリ | 158,656 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 00:16:40 |
| 合計ジャッジ時間 | 2,559 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 59 WA * 2 |
ソースコード
#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 << "Kanzesu!";
}else{
cout << n;
}
}