結果

問題 No.680 作れる数
ユーザー amtgjw
提出日時 2018-06-04 19:47:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 681 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 63,784 KB
実行使用メモリ 814,720 KB
最終ジャッジ日時 2024-06-30 09:45:37
合計ジャッジ時間 3,476 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other MLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MINF		-200000007
#define MOD			1048576 	
// 2^20

#define MAX 		1000005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

//int dp[MAX];

bool bfs(int tar,ll n){
	if(tar == n) return true;
	else if (tar < n) return false;
	
	return bfs(tar-n,n*2)|bfs(tar-n,n*2+1);
}

int main(){
	int N;cin>>N;
	
	if(bfs(N,0))
		cout << "YES" << endl;
	else	
		cout << "NO" << endl;

	return 0;
}
0