結果
問題 |
No.889 素数!
|
ユーザー |
|
提出日時 | 2019-09-20 23:03:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 851 bytes |
コンパイル時間 | 874 ms |
コンパイル使用メモリ | 74,388 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 19:29:12 |
合計ジャッジ時間 | 2,360 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 60 WA * 1 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <queue> #include <cmath> bool f0(int N) { if (N<2) return false; for (int i=2;i<N;++i) if (N%i==0) return false; return true; } bool f1(int N) { if (N==1) return false; for (int i=2;i<N;++i) if (N==i*i) return true; return false; } bool f2(int N) { if (N==1) return false; for (int i=2;i<N;++i) if (N==i*i*i) return true; return false; } bool f3(int N) { long long sum=0; for (int i=1;i<N;++i) if (N%i==0) sum+=i; return sum==N; } int main() { int N; std::cin>>N; if (f0(N)) { std::cout<<"Sosu!"<<std::endl; } else if (f1(N)) { std::cout<<"Heihosu!"<<std::endl; } else if (f2(N)) { std::cout<<"Ripposu!"<<std::endl; } else if (f3(N)) { std::cout<<"Kanzensu!"<<std::endl; } else { std::cout<<N<<std::endl; } return 0; }