結果
| 問題 | No.680 作れる数 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-10 13:41:52 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 348 bytes | 
| コンパイル時間 | 2,909 ms | 
| コンパイル使用メモリ | 189,356 KB | 
| 最終ジャッジ日時 | 2025-01-11 00:47:25 | 
| ジャッジサーバーID (参考情報) | judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 TLE * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
int n;
bool dfs(int t,lint sum){
	if(sum>n) return false;
	if(sum==n) return true;
	if(dfs(2*t,sum+2*t) || dfs(2*t+1,sum+2*t+1)) return true;
	return false;
}
int main(){
	scanf("%d",&n);
	puts(n==0||dfs(1,1)?"YES":"NO");
	return 0;
}
            
            
            
        