結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2019-09-23 22:48:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 1,380 ms |
コンパイル使用メモリ | 167,676 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 04:43:16 |
合計ジャッジ時間 | 2,766 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=1e9+7; int N; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>N; for(int i=2; i<=N; i++){ if(i*i==N){ cout<<"Heihosu!"<<endl; return 0; } if(i*i*i==N){ cout<<"Ripposu!"<<endl; return 0; } } int s=0; bool f=false; for(int i=1; i<=sqrt(N); i++){ if(N%i==0){ s+=i; if(i!=(N/i)) s+=(N/i); if(i>1&&i<N) f=true; if((N/i)>1&&(N/i)<N) f=true; } } s-=N; if(s==N){ if(N!=0){ cout<<"Kanzensu!"<<endl; return 0; } } if(!f){ if(N>1){ cout<<"Sosu!"<<endl; return 0; } } cout<<N<<endl; }