結果
問題 |
No.2795 Perfect Number
|
ユーザー |
|
提出日時 | 2024-06-29 22:47:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 1,457 ms |
コンパイル使用メモリ | 165,856 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-06-29 22:47:22 |
合計ジャッジ時間 | 5,256 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 1 TLE * 1 -- * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) using ll = long long int; int main() { ll N; cin >> N; ll ans = 0; ll n2 = N * 2; ll k = 1; while (n2 > 0) { if (N % k == 0) { n2 -= k + N / k; ans += k + N / k; } k++; } if (ans == N * 2) cout << "Yes" << endl; else cout << "No" << endl; return 0; }