結果

問題 No.680 作れる数
ユーザー iicafiaxus
提出日時 2018-06-24 22:37:49
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 125,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-13 01:15:06
合計ジャッジ時間 1,408 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	
	long[] bs;
	for(long b = 1; b < n; b *= 2, b += 1) bs ~= b;
	
	foreach_reverse(b; bs) if(n >= b) n -= b;
	
	if(n == 0) "YES".writeln;
	else "NO".writeln;
	
	}
0