結果

問題 No.889 素数!
ユーザー ui_mtcui_mtc
提出日時 2019-09-20 23:15:31
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 2,235 ms
コンパイル使用メモリ 160,724 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 20:02:09
合計ジャッジ時間 3,143 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  
  if( N == 0 ){
    cout << 0 << endl;
    return 0;
  }
  
  int kazu = 0;
  for( int i = 1; i < N; i++ ){
    if( N % i == 0 ) kazu += i;
    if( i*i == N ){
      cout << "Heihosu!" << endl;
      return 0;
    }else if( i*i*i == N ){
      cout << "Ripposu!" << endl;
      return 0;
    }
  }
  if( N == kazu ){
    cout << "Kanzensu!" << endl;
    return 0;
  }
  
  vector<int> sosu(17);
  sosu = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61 };
  for( int i = 0; i < 18; i++ ){
    if( N == sosu.at(i) ){
      cout << "Sosu!" << endl;
      return 0;
    }
  }
  cout << N << endl;
}
0