結果

問題 No.1680 Sum and Difference
ユーザー sssr1031
提出日時 2022-07-09 23:56:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 1,261 ms
コンパイル使用メモリ 160,740 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-01 18:04:08
合計ジャッジ時間 2,166 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%lld %lld", &A, &B);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int MOD = 1e9 + 7;

int main(void) {
  ll A, B;
  scanf("%lld %lld", &A, &B);

  A %= MOD;
  B %= MOD;

  if (A % 2 == B % 2) printf("%lld\n", (2 * A % MOD * B % MOD + (A + B) % MOD + 1) % MOD);
  else printf("%lld\n", (2 * A % MOD * B % MOD + (A + B) % MOD) % MOD);

  return 0;
}
0