103280: [Atcoder]ABC328 A - Not Too Hard

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

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

Output

分数:$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$或更少:第一个、第四个和第五个,总分为$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

HINT

n个数,统计不超过x的数字之和?

加入题单

算法标签: