結果

問題 No.889 素数!
ユーザー Mcpu3
提出日時 2019-09-21 16:58:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 70,696 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 02:41:17
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <iostream>
using namespace std;

int main() {
	int N, a = 0, i;
	cin >> N;
	if (0 == N || 1 == N) cout << N;
	else {
		for (i = 1; i < N; ++i) {
			if (0 == N % i) a += i;
		}
		if (N == a) cout << "Kanzensu!";
		else {
			for (i = 2; i < N; ++i) {
				if (0 == N % i) break;
			}
			if (N == i) cout << "Sosu!";
			else {
				if (ceil(pow(N, 1.0 / 3.0)) == pow(N, 1.0 / 3.0)) cout << "Ripposu!";
				else {
					if (ceil(sqrt(N)) == sqrt(N)) cout << "Heihosu!";
					else cout << N;
				}
			}
		}
	}
}
0