結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2023-08-23 10:04:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 920 ms |
コンパイル使用メモリ | 101,528 KB |
最終ジャッジ日時 | 2025-02-16 12:30:53 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> using namespace std; int main() { int n, sum1 = 0, f = 0; cin >> n; int t = pow(n, 0.5); for (int i = 2; i <= t; i++){ if (n == i*i*i){ cout << "Ripposu!" << endl; return 0; } if (n == i*i){ cout << "Heihosu!" << endl; return 0; } if (n != 1 && !(n%i)) f++; if (!(n%i)){ if (i != n/i) sum1 += (i + n/i); else sum1 += i; } } sum1 += 1; if (n != 0 && n != 1 && sum1 == n){ cout << "Kanzensu!" << endl; return 0; } if (n != 0 && n != 1 && !f) cout << "Sosu!" << endl; else cout << n << endl; }