Submission #97326


Source Code Expand

#include <cstdio>

using namespace std;

int main()
{
    int n;
    bool a[10001] = {};
    a[0] = true;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        int p;
        scanf("%d", &p);
        for (int j = 10000; j >= 0; --j)
            if (a[j])
                a[j + p] = true;
    }

    int ans = 0;
    for (int i = 0; i < 10001; ++i)
        if (a[i])
            ++ans;
    printf("%d\n", ans);

    return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User yuji314159
Language C++ (G++ 4.6.4)
Score 2
Code Size 464 Byte
Status AC
Exec Time 19 ms
Memory 676 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:14:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name All
Score / Max Score 2 / 2
Status
AC × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 AC 17 ms 660 KB
01 AC 19 ms 652 KB
02 AC 19 ms 664 KB
90 AC 18 ms 676 KB
91 AC 19 ms 656 KB