結果
問題 | No.1176 少ない質問 |
ユーザー |
![]() |
提出日時 | 2020-08-21 22:03:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 787 bytes |
コンパイル時間 | 1,601 ms |
コンパイル使用メモリ | 165,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 05:39:29 |
合計ジャッジ時間 | 2,387 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longtypedef pair<int,int> P;int INF = 1e16+7;int mod = 1e9+7;int dx[4] = {1, 0, -1, 0};int dy[4] = {0, 1, 0, -1};signed main() {int A;cin >> A;int N = A;int ans = INF;int cnt = 0;int pow = 1;while (true) {cnt++;if((N+1)/2 <= pow) {break;}pow*=2;}ans = min(ans,2*cnt);cnt = 0;pow = 1;N = A;while (true) {cnt++;if((N+2)/3 <= pow) {break;}pow*=3;}ans = min(ans,3*cnt);cnt = 0;pow = 1;while (true) {cnt++;if((N+4)/5 <= pow) {break;}pow*=5;}cout << min(ans,5*cnt) << endl;}