結果

問題 No.853 河原の石
ユーザー risujiroh
提出日時 2019-07-26 21:58:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 1,354 ms
コンパイル使用メモリ 167,384 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-02 07:12:15
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 53
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint h, w; cin >> h >> w;
  w = abs(w);
  if (!h or !w) return cout << 0 << '\n', 0;
  lint q = w / h, r = w - q * h;
  lint res = q * (h * (h + 1) / 2) + (r ? h + r * (r - 1) / 2 : 0);
  cout << res << '\n';
}
0