結果

問題 No.1680 Sum and Difference
ユーザー moondrink
提出日時 2021-09-22 20:31:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 2,291 ms
コンパイル使用メモリ 190,000 KB
最終ジャッジ日時 2025-01-24 16:14:36
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%lld %lld",&a,&b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;

ll a,b;

int main()
{
    scanf("%lld %lld",&a,&b);
    ll ans = 0;
    ans += (2ll * a % mod * b % mod) % mod + a % mod + b % mod + 1ll;;
    ans %= mod;
    if(a - b & 1ll) ans -= 1ll;
    printf("%lld\n",ans % mod);
    return 0;
}
0