結果

問題 No.1680 Sum and Difference
ユーザー ぷら
提出日時 2021-09-17 22:01:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 192,848 KB
最終ジャッジ日時 2025-01-24 14:57:07
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 1000000007;

int main() {
    long long A,B;
    cin >> A >> B;
    long long ans = A/2*2+1;
    ans %= mod;
    ans += (A*4+2)%mod*(B/2)%mod;
    if(B%2 == 1) {
        if(A%2 == 0) {
            ans += A*2;
            ans %= mod;
        }
        else {
            ans += A*2+2;
            ans %= mod;
        }
    }
    cout << ans << endl;
}

0