結果

問題 No.1680 Sum and Difference
コンテスト
ユーザー 沙耶花
提出日時 2021-09-17 21:34:29
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 870µs
コード長 607 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,906 ms
コンパイル使用メモリ 275,172 KB
実行使用メモリ 9,876 KB
最終ジャッジ日時 2026-10-15 21:18:06
合計ジャッジ時間 4,697 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
 
 
int main(){
	
	long long A,B;
	cin>>A>>B;
	
	long long a = A*2+1;
	long long b = B*2+1;
	
	mint ans = 0;
	
	if(B%2==A%2){
		mint temp = a/2+1;
		temp *= (b+1)/2;
		ans += temp;
		
		temp = a/2;
		temp *= (b)/2;
		ans += temp;
		
	}
	else{
		mint temp = a/2;
		temp *= (b+1)/2;
		ans += temp;
		
		temp = a/2+1;
		temp *= (b)/2;
		ans += temp;
		
	}
	
	cout<<ans.val()<<endl;
	
	return 0;
}
0