提交记录 6961


用户 题目 状态 得分 用时 内存 语言 代码长度
zengminghao noip18b. 【NOIP2018】货币系统 Accepted 100 6.169 ms 64 KB C++11 683 B
提交时间 评测时间
2018-11-24 18:02:56 2020-08-01 00:55:19
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int T, n, a[233];
bool ex[50005];
int main() {
    scanf("%d", &T);
    while (T--) {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", a + i);
        memset(ex, 0, sizeof ex);
        ex[0] = 1;
        sort(a + 1, a + n + 1);
        int mx = 0, ans = 0;
        for (int i = 1; i <= n; i++)
            mx = max(mx, a[i]);
        for (int i = 1; i <= n; i++) {
            if (ex[a[i]]) continue;
            for (int j = a[i]; j <= mx; j++)
                ex[j] |= ex[j - a[i]];
            ans++;
        }
        printf("%d\n", ans);
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #144.26 us64 KBAcceptedScore: 5

Testcase #249.18 us64 KBAcceptedScore: 5

Testcase #349.59 us64 KBAcceptedScore: 5

Testcase #444.71 us64 KBAcceptedScore: 5

Testcase #548.56 us64 KBAcceptedScore: 5

Testcase #648.37 us64 KBAcceptedScore: 5

Testcase #749.82 us64 KBAcceptedScore: 5

Testcase #849.1 us64 KBAcceptedScore: 5

Testcase #954.97 us64 KBAcceptedScore: 5

Testcase #1057.99 us64 KBAcceptedScore: 5

Testcase #1153.4 us64 KBAcceptedScore: 5

Testcase #1252.27 us64 KBAcceptedScore: 5

Testcase #1351.23 us64 KBAcceptedScore: 5

Testcase #1473.78 us64 KBAcceptedScore: 5

Testcase #1568.96 us64 KBAcceptedScore: 5

Testcase #1669.48 us64 KBAcceptedScore: 5

Testcase #176.024 ms64 KBAcceptedScore: 5

Testcase #186.058 ms64 KBAcceptedScore: 5

Testcase #196.04 ms64 KBAcceptedScore: 5

Testcase #206.169 ms64 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:07:55 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠