No.799 Red and Black Card Game
タグ : / 解いたユーザー数 647
作問者 :
tempura_pp
/ テスター :
heno239
Problem Statement
Homu-chan has two boxes, one red and one black.
The red box contains red cards, one for each integer between $A$ and $B$ inclusive, with that integer written on it.
The black box contains black cards, one for each integer between $C$ and $D$ inclusive, with that integer written on it.
Homu-chan took one card from each of the two boxes, and the numbers written on the red card and the black card taken were different.
Find the number of such ways to take the cards.
Input
$A\ B\ C\ D$
- $1\le A, B, C, D\le 100$
- $A\le B$
- $C\le D$
- All inputs are integers.
Output
Output in one line the number of ways to take the cards such that the numbers on the two cards are different.
Sample
Sample 1
Input
1 3 2 4
Output
7
(red, black) = (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 2), (3, 4), for a total of 7 ways.
Sample 2
Input
1 5 6 10
Output
25
Sample 3
Input
1 100 1 100
Output
9900
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。