結果
問題 |
No.889 素数!
|
ユーザー |
![]() |
提出日時 | 2019-09-20 21:43:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 919 bytes |
コンパイル時間 | 1,747 ms |
コンパイル使用メモリ | 168,672 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-09-14 17:05:24 |
合計ジャッジ時間 | 3,420 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 60 WA * 1 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; bool isprime(long long int val) { if (val <= 1)return false; for (long long int i = 2; i*i <= val; i++) { if (val%i == 0LL)return false; } return true; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); ll n; cin>>n; if(isprime(n)){ cout << "Sosu!" << endl; return 0; } for(ll i=2;i<n;i++){ if(i*i==n){ cout << "Heihosu!"<<endl; return 0; } if(i*i*i==n){ cout << "Ripposu!" << endl; return 0; } } ll ans = 0; for(ll i=1;i*i<=n;i++){ if(n%i==0){ ans += i; if(i*i!=n) ans += n/i; } } ans-=n; if(ans==n){ cout << "Kanzensu!"<<endl; return 0; } cout << n << endl; }