結果
| 問題 |
No.2795 Perfect Number
|
| コンテスト | |
| ユーザー |
mint
|
| 提出日時 | 2024-06-28 23:49:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 561 bytes |
| コンパイル時間 | 2,393 ms |
| コンパイル使用メモリ | 198,332 KB |
| 最終ジャッジ日時 | 2025-02-22 01:26:56 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 TLE * 1 -- * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*
Happy birthday!!!!
\(^o^)/
*/
vector<ll> yk(ll n){
vector<ll> y;
for(ll i = 1; i * i <= n; ++i){
if(n%i != 0) continue;
y.emplace_back(i);
if(n/i != i) y.emplace_back(n/i);
}
sort(y.begin(), y.end());
return y;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, z = 0; cin >> n;
auto y = yk(n);
for(auto e : y) z += e;
if(z == 2*n) cout << "Yes" << '\n';
else cout << "No" << '\n';
return 0;
}
mint