結果

問題 No.680 作れる数
ユーザー amtgjwamtgjw
提出日時 2018-06-04 19:49:04
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 687 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 63,688 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-12 22:14:19
合計ジャッジ時間 15,608 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 39 ms
4,376 KB
testcase_09 AC 256 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,504 KB
testcase_12 AC 1,965 ms
4,380 KB
testcase_13 AC 757 ms
4,376 KB
testcase_14 AC 1,885 ms
4,376 KB
testcase_15 AC 1,232 ms
4,376 KB
testcase_16 AC 1,121 ms
4,380 KB
testcase_17 AC 1,775 ms
4,376 KB
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

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,1)||N==0)
		cout << "YES" << endl;
	else	
		cout << "NO" << endl;

	return 0;
}
0