結果

問題 No.2795 Perfect Number
ユーザー ゆきどけ
提出日時 2024-06-28 21:52:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 364 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 165,980 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-06-28 21:52:30
合計ジャッジ時間 4,779 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;

using ll = long long;
using ld = long double;

int main()
{
	ll n; cin >> n;
	ll sum = 0;
	for(ll i = 1; i * i <= n; i++) {
		if(n % i == 0) {
			sum += i;
			if(i * i != n) sum += n / i;
		}
	}
	if(sum == 2 * n) cout << "Yes" << endl;
	else cout << "No" << endl;
}
0