Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
N 問の問題が出題されるプログラミングコンテストがあります。 i = 1, 2, \ldots, N について、i 問目の配点は S_i です。
配点が X 以下である問題すべての配点の合計を出力してください。
制約
- 入力される値は全て整数
- 4 \leq N \leq 8
- 100 \leq S_i \leq 675
- 100 \leq X \leq 675
入力
入力は以下の形式で標準入力から与えられる。
N X S_1 S_2 \ldots S_N
出力
答えを出力せよ。
入力例 1
6 200 100 675 201 200 199 328
出力例 1
499
配点が 200 以下である問題は、1, 4, 5 問目の全 3 問であり、それらの配点の合計は S_1 + S_4 + S_5 = 100 + 200 + 199 = 499 です。
入力例 2
8 675 675 675 675 675 675 675 675 675
出力例 2
5400
入力例 3
8 674 675 675 675 675 675 675 675 675
出力例 3
0
Score : 100 points
Problem Statement
There is a programming contest with N problems. For each i = 1, 2, \ldots, N, the score for the i-th problem is S_i.
Print the total score for all problems with a score of X or less.
Constraints
- All input values are integers.
- 4 \leq N \leq 8
- 100 \leq S_i \leq 675
- 100 \leq X \leq 675
Input
The input is given from Standard Input in the following format:
N X S_1 S_2 \ldots S_N
Output
Print the answer.
Sample Input 1
6 200 100 675 201 200 199 328
Sample Output 1
499
Three problems have a score of 200 or less: the first, fourth, and fifth, for a total score of S_1 + S_4 + S_5 = 100 + 200 + 199 = 499.
Sample Input 2
8 675 675 675 675 675 675 675 675 675
Sample Output 2
5400
Sample Input 3
8 674 675 675 675 675 675 675 675 675
Sample Output 3
0