結果
| 問題 | 
                            No.642 Two Operations No.1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kiwamarinaku
                         | 
                    
| 提出日時 | 2018-05-08 14:43:27 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 239 bytes | 
| コンパイル時間 | 1,256 ms | 
| コンパイル使用メモリ | 156,892 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 02:27:10 | 
| 合計ジャッジ時間 | 1,897 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 9 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%lld", &n);
      |   ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x = 1, cnt = 0;
  scanf("%lld", &n);
  while (x < n) {
    x *= 2;
    cnt++;
  }
  while (x != n) {
    x--;
    cnt++;
  }
  printf("%lld\n", cnt);
  return 0;
}
            
            
            
        
            
kiwamarinaku