No.1680 Sum and Difference
レベル :
/ AI推定難易度 : 800
/ 実行時間制限 : 1ケース 1.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 158
作問者 :
Sumitacchan
/ テスター :
👑
hitonanode
ygussany
タグ : / 解いたユーザー数 158
作問者 :
Sumitacchan
/ テスター :
👑
hitonanode
問題文最終更新日: 2021-08-29 10:20:15
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 314
(順位表)
の他の問題:
Problem Statement
How many pairs of integers $(x,y)$ satisfy both of the following $2$ conditions?
- $|x+y|\le A$
- $|x-y|\le B$
Since the answer can be very large, output it modulo $10^9+7$.
Input
$A\ \ B$
- $0\le A \le 10^{18}$
- $0\le B \le 10^{18}$
- All inputs are integers.
Output
Output the number of pairs of integers $(x,y)$ satisfying the conditions, modulo $10^9+7$.
Sample
Sample 1
Input
1 1
Output
5
There are $5$ pairs: $(x,y)=(-1,0),(0,-1),(0,0),(0,1),(1,0)$.
Sample 2
Input
3 0
Output
3
There are $3$ pairs: $(x,y)=(-1,-1),(0,0),(1,1)$.
Sample 3
Input
998244353 924844033
Output
693995100
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。