結果

問題 No.680 作れる数
ユーザー amtgjwamtgjw
提出日時 2018-06-04 19:46:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 63,720 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 22:14:32
合計ジャッジ時間 12,547 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 32 ms
4,380 KB
testcase_09 AC 211 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1,619 ms
4,380 KB
testcase_13 AC 625 ms
4,376 KB
testcase_14 AC 1,551 ms
4,380 KB
testcase_15 AC 1,020 ms
4,376 KB
testcase_16 AC 927 ms
4,376 KB
testcase_17 AC 1,463 ms
4,376 KB
testcase_18 AC 1,737 ms
4,380 KB
testcase_19 AC 1,827 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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))
		cout << "YES" << endl;
	else	
		cout << "NO" << endl;

	return 0;
}
0