[Offer收割]编程练习赛4 register

Ended

Participants:899

Verdict:Accepted
Score:100 / 100
Submitted:2016-08-07 12:11:32

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
*   Copyright (C) 2016 All rights reserved.
*   
*   filename: a.cpp
*   author: doublehh
*   e-mail: sserdoublehh@foxmail.com
*   create time: 2016-08-07 12:09:26
*   last modified: 2016-08-07 12:09:26
*/
#include<bits/stdc++.h>
using namespace std;
const int maxn = 10001;
int n, m;
bool f[maxn];
int main()
{
    scanf("%d %d", &n, &m);
    f[0] = true;
    for (int i = 0; i < n; i++)
    {
        int x;
        scanf("%d", &x);
        for (int j = maxn - 1; j >= x; j--)
            f[j] |= f[j - x];
    }
    for (int i = m; i < maxn; i++)
        if (f[i])
        {
            printf("%d\n", i);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX