結果
問題 |
No.1286 Stone Skipping
|
ユーザー |
|
提出日時 | 2020-11-13 22:44:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 1,548 ms |
コンパイル使用メモリ | 166,704 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 21:44:39 |
合計ジャッジ時間 | 2,450 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int64_t d; cin>>d; int64_t ans=d; for(int64_t i=1;i<60;i++){ int64_t n=d/(1ll<<i+1)*(1ll<<i); for(int64_t j=0;j<64;j++){ int64_t x=n+j,sum=0; while(x>0){ sum+=x,x/=2; if(sum==d)ans=min(ans,n+j); } } } cout<<ans<<'\n'; }