結果

問題 No.2795 Perfect Number
ユーザー mint
提出日時 2024-06-28 23:55:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 461 bytes
コンパイル時間 8,643 ms
コンパイル使用メモリ 192,528 KB
最終ジャッジ日時 2025-02-22 01:27:38
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

/*

Happy birthday!!!!
\(^o^)/

*/

ll yk(ll n){
    ll y = 0;
    for(ll i = 1; i * i <= n; ++i){
        if(n%i != 0) continue;
        y += i;
        if(n/i != i) y += (n/i);
    }
    return y;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    ll z = yk(n);
    if(z == 2*n) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}
0