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