結果
| 問題 |
No.853 河原の石
|
| コンテスト | |
| ユーザー |
square1001
|
| 提出日時 | 2019-07-26 23:16:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 352 bytes |
| コンパイル時間 | 685 ms |
| コンパイル使用メモリ | 73,040 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-02 09:32:44 |
| 合計ジャッジ時間 | 2,002 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 57 |
ソースコード
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
int startline = max(W - H, 0);
long long ans = abs(H - W) + 1;
for (int i = 0; i < 30; ++i) {
int l = max(startline, 1 << i), r = min(W, 2 << i);
if (l < r) ans += 1LL * (r - l) * (i + 2);
}
cout << ans << endl;
return 0;
}
square1001