結果
| 問題 |
No.1176 少ない質問
|
| コンテスト | |
| ユーザー |
PCTprobability
|
| 提出日時 | 2020-07-25 10:37:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 586 bytes |
| コンパイル時間 | 787 ms |
| コンパイル使用メモリ | 80,012 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 00:00:26 |
| 合計ジャッジ時間 | 1,740 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39,
from main.cpp:1:
In member function '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:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
202 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:30:6: note: 'ans' was declared here
30 | ll ans;
| ^~~
ソースコード
#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;
}
}
PCTprobability