結果
| 問題 | 
                            No.1803 Remainder of Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-01-07 22:50:55 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 374 bytes | 
| コンパイル時間 | 3,359 ms | 
| コンパイル使用メモリ | 163,124 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-14 08:59:49 | 
| 合計ジャッジ時間 | 3,748 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 1 WA * 7 | 
ソースコード
/*
 * Author: nskybytskyi
 * Time:   2022-01-07 14:20:00
 */
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int t; cin >> t; while (t--) {
    int n, m;
    cin >> n >> m;
    if (m <= n) {
      cout << m / 2 << "\n";
    } else {
      cout << ((m - n) * 1ll * (m - n + 5)) / 2 + m + 1 << "\n";
    }
  }
  return 0;
}