結果

問題 No.1680 Sum and Difference
ユーザー 👑 hitonanodehitonanode
提出日時 2021-08-08 15:15:27
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 377 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 2,915 ms
コンパイル使用メモリ 80,796 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 06:18:21
合計ジャッジ時間 6,560 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 189 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 24 ms
4,380 KB
testcase_07 AC 190 ms
4,380 KB
testcase_08 AC 189 ms
4,376 KB
testcase_09 AC 189 ms
4,380 KB
testcase_10 AC 45 ms
4,380 KB
testcase_11 AC 273 ms
4,376 KB
testcase_12 AC 277 ms
4,380 KB
testcase_13 AC 155 ms
4,376 KB
testcase_14 AC 220 ms
4,376 KB
testcase_15 AC 12 ms
4,380 KB
testcase_16 AC 251 ms
4,380 KB
testcase_17 AC 345 ms
4,380 KB
testcase_18 AC 295 ms
4,376 KB
testcase_19 AC 159 ms
4,376 KB
testcase_20 AC 377 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using lint = long long;


constexpr unsigned md = 1000000007;
int main() {
    long long A, B;
    cin >> A >> B;
    A %= (md * 2);
    B %= (md * 2);
    unsigned long long ret = 0;
    for (int sum = -A; sum <= A; sum++) {
        if (sum & 1) {
            ret += (B + 1) / 2 * 2;
        } else {
            ret += 1 + B / 2 * 2;
        }
    }
    cout << ret % md << '\n';
}
0