結果

問題 No.889 素数!
ユーザー yicode
提出日時 2023-05-16 13:14:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 1,726 ms
コンパイル使用メモリ 170,764 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-12-14 14:00:56
合計ジャッジ時間 3,621 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
vector<vector<int>> X(1000, vector<int>(1000));
long long primeNumber(long long x) {
  bool fire = true;
  if(x == 0) {
    return false;
  }
  if(x == 1) {
    return false;
  }
  for(int i = 2; i <= sqrt(x); i++) {
    if(x % i == 0) {
      fire = false;
    }
  }
  return fire;
}
int main() {
  int N; cin >> N;
  if(primeNumber(N)) {
    cout << "Sosu!" << endl;
    return 0;
  }
  bool heihou = false;
  bool rippou = false;
  for(int i= 2; i <= 8; i++) {
    if(N == i * i) {
      heihou = true;
    }
    if(N == i * i * i) {
      rippou = true;
    }
  }
  if(heihou) {
    cout << "Heihosu!" << endl;
    return 0;
  }
  if(rippou) {
    cout << "Ripposu!" << endl;
    return 0;
  }
  if(N == 6 || N == 28) {
    cout << "Kanzensu!" << endl;
    return 0;
  }
  cout << N << endl;
}
0