結果
| 問題 |
No.2795 Perfect Number
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-07-03 13:50:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 520 bytes |
| コンパイル時間 | 266 ms |
| コンパイル使用メモリ | 39,680 KB |
| 最終ジャッジ日時 | 2025-02-22 01:53:51 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | scanf("%lld", &n);
| ~~~~~^~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 2795.cc: No.2795 Perfect Number - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const long long pfns[] = {
6LL,
28LL,
496LL,
8128LL,
33550336LL,
8589869056LL,
137438691328LL,
2305843008139952128LL,
//1000000000000000000
};
/* typedef */
using ll = long long;
/* main */
int main() {
ll n;
scanf("%lld", &n);
int k = 0;
while (pfns[k] < n) k++;
if (pfns[k] == n) puts("Yes");
else puts("No");
return 0;
}
tnakao0123