Range Integer Counter


Submit solution

Points: 20 (partial)
Time limit: 1.0s
Memory limit: 1000M

Authors:
Problem type

寫一個程式計算在指定範圍內的數字。

輸入有三個正整數,分別為下限值、上限值、停止訊號,以及後續一個或多個候選數字,候選數字為任意整數。

若候選數字大於等於下限值且小於等於上限值,則視為合法數字。

程式依序盤點每個候選數字,若該數字為合法數字,則計數加一,若遇到停止訊號,則立即停止計數並忽略後續所有數字。候選數字中有一個以上的停止訊號。

輸出為停止訊號前的合法數字總個數。

Input

0 10 3 1 2 3 4

Output

2

因為0<=1<=10, 0<=2<=10,4在停止訊號3後面,所以4不算在內

Input

0 10 5 0 10 -1 11 5 0 10 -1 11

Output

2

因為0<=0<=10, 0<=10<=10, -1和11在合法範圍外


Comments

There are no comments at the moment.