結果

問題 No.1176 少ない質問
ユーザー Drice
提出日時 2020-08-21 22:12:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 343 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 31,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 05:46:00
合計ジャッジ時間 893 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>

int gcd(int a,int b){ return b?gcd(b,a%b):a; }

int main(){
    long long n;
    scanf("%lld",&n);
    long long org = n;
    int cnt = 0;
    while(n!=0) n /= 2, cnt += 2;
    int next = 0;
    if(org<=5) cnt = org;
    while(org!=0) org /= 3, next += 3;
    if(next<cnt) cnt = next;
    printf("%d\n",cnt);
    return 0;
}
0