結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー lunnear
提出日時 2018-12-11 15:49:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 53,768 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 01:02:48
合計ジャッジ時間 1,356 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 4 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main()
{
    int n, ans = 0;
    std::cin >> n;
    
    while(n > 1)
    {
        if(n % 2)
        {
            n--;
            ans++;
            continue;
        }
        
        n /= 2;
        ans++;
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}
0