結果
問題 | No.2416 vs Slime |
ユーザー |
|
提出日時 | 2023-08-12 14:03:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 441 bytes |
コンパイル時間 | 1,741 ms |
コンパイル使用メモリ | 168,112 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 17:13:26 |
合計ジャッジ時間 | 2,853 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 37 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;int main(){ll H,A;cin >> H >> A;//2の何乗までの合計か?ll cnt = 0;while(H>0){H/=A;cnt++;}//cout << cnt << endl;//2のcnt-1乗までの合計vector<ll>two(cnt);two[0]=1;for(ll i = 1;i < cnt;i++)two[i]=two[i-1]*2;ll sum = 0;for(ll i = 0;i < cnt;i++)sum+=two[i];cout << sum << endl;}