結果
問題 |
No.642 Two Operations No.1
|
ユーザー |
|
提出日時 | 2018-02-06 05:44:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 200 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 64,000 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 13:46:39 |
合計ジャッジ時間 | 1,073 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 9 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int n,ans=1e9,c,t,j; main() { cin>>n; for(;n>=1;n/=2,t++) { for(c=0,j=1;j<n;c++)j*=2; c+=t+j-n; ans=ans>c?c:ans; if(n%2)break; } cout<<ans<<endl; }