結果

問題 No.1176 少ない質問
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2020-07-25 10:37:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 586 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 78,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 06:51:19
合計ジャッジ時間 1,940 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/iostream:39,
         次から読み込み:  main.cpp:1:
メンバ関数 ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’ 内,
    inlined from ‘int main()’ at main.cpp:47:9:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:30:6: 備考: ‘ans’ はここで定義されています
   30 |   ll ans;
      |      ^~~

ソースコード

diff #

#include <iostream>
#include <random>
using namespace std;
using ll = long long;
ll gcds(ll a,ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcds(b, a%b));
   }
}
ll si(ll a,ll b){
  ll r=gcds(a,b);
  return a/r;
}
ll bo(ll a,ll b){
  ll r=gcds(a,b);
  return b/r;
}
int main(){
  ll s;
 cin>>s;
  ll a,b;
  a=1;
  b=1;
  ll ans;
  for(int i=1;s>a;i++){
    a=a*2;
    if(a>=s){
      ans=2*i;
    }
  }
  for(ll i=1;s>b;i++){
    b=b*3;
    if(b>=s){
      ans=min(3*i,ans);
    }
  }
  if(s==5){
      cout<<5<<endl;
  }
  else{
  cout<<ans<<endl;
}
}
0