AtCoder Beginner Contest 199(Sponsored by Panasonic)
翻译中…
Problem Statement
翻译中…
You are given sequences of length $N$ each: $A = (A_1, A_2, A_3, \dots, A_N)$ and $B = (B_1, B_2, B_3, \dots, B_N)$.
Find the number of integers $x$ satisfying the following condition:
翻译中…
$A_i \le x \le B_i$holds for every integer$i$such that$1 \le i \le N$.
翻译中…
Constraints
翻译中…
$1 \le N \le 100$$1 \le A_i \le B_i \le 1000$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
A_1 A_2 A_3 \dots A_N
B_1 B_2 B_3 \dots B_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
2
3 2
7 5
Output #1
3
$x$ must satisfy both $3 \le x \le 7$ and $2 \le x \le 5$.
There are three such integers: $3$, $4$, and $5$.
Input #2
3
1 5 3
10 7 3
Output #2
0
There may be no integer $x$ satisfying the condition.
Input #3
3
3 2 5
6 9 8
Output #3
2
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。