問題一覧 > 通常問題

No.799 Red and Black Card Game

レベル : / AI推定難易度 : 111 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 647
作問者 : tempura_pp / テスター : heno239
お気に入りにしたユーザー ProblemId : 2814 / 自分の提出
問題文最終更新日: 2019-03-17 20:07:14
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 208 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。