結果
問題 |
No.1450 nahco314's First Problem
|
ユーザー |
|
提出日時 | 2021-04-03 13:26:08 |
言語 | Kuin (KuinC++ v.2021.9.17) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 7,290 ms |
コンパイル使用メモリ | 146,472 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 14:26:56 |
合計ジャッジ時間 | 3,917 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
func main() var x: int :: cui@inputInt() var ans: int :: -1 for n([x - 100, 1].max(), x + 100) if((n $ bit64).xor(hammingWeight(n)) = x $ bit64) do ans :: n break n end if end for do cui@print("\{ans}\n") func hammingWeight(n: int): bit64 var res: int :: 0 while(n <> 0) if(n % 2 = 1) do res :+ 1 end if do n :/ 2 end while ret res $ bit64 end func end func