結果
問題 | No.1862 Copy and Paste |
ユーザー |
![]() |
提出日時 | 2024-11-13 09:20:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 750 ms |
コンパイル使用メモリ | 76,764 KB |
最終ジャッジ日時 | 2025-02-25 04:01:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 11 WA * 16 |
ソースコード
#include<iostream>#include<queue>using namespace std;long long a,b;long long n;int main(){cin >> a >> b >> n;if(n==1){cout << 0;return 0;}long long ans=a+(n-1)*b;for(int i=2;(1ll<<(i-1))<=n;i++){priority_queue<int,vector<int>,greater<int>> p;int pr=1,j=i;for(int k=1;k<=i;k++){pr<<=1;p.push(2);}while(pr<n){auto fnt=p.top();p.pop();pr=pr*(fnt+1)/fnt;++j;p.push(fnt);}ans=min(ans,a*i+b*j);}cout << ans;return 0;}