結果

問題 No.680 作れる数
ユーザー Kutimoti_T
提出日時 2018-05-12 09:47:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 157,796 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-28 09:31:21
合計ジャッジ時間 2,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

i64 N;

int main(){
  cin >> N;
  for(int i= 30;i >= 0;i--){
    i64 now = (1LL << i) - 1;
    if(now <= N) N -= now;
  }

  if(N == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}
0