提交记录 9587


用户 题目 状态 得分 用时 内存 语言 代码长度
emapans noip18b. 【NOIP2018】货币系统 Accepted 100 8.079 ms 40 KB C++ 579 B
提交时间 评测时间
2019-06-13 17:33:28 2020-08-01 01:41:04
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N=105;
int n,a[N];
bool f[25005];

int main() {
    int T;
    for(scanf("%d",&T);T--;) {
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;++i) scanf("%d",&a[i]),mx=mx>a[i]?mx:a[i];
        std::sort(a+1,a+n+1);
        memset(f,0,sizeof(f));
        f[0]=1;
        int ans=0;
        for(int i=1;i<=n;++i) {
            if(!f[a[i]]) {
                ++ans;
                for(int j=a[i];j<=mx;++j) f[j]|=f[j-a[i]];
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #129.17 us40 KBAcceptedScore: 5

Testcase #233.88 us40 KBAcceptedScore: 5

Testcase #343.05 us40 KBAcceptedScore: 5

Testcase #435.89 us40 KBAcceptedScore: 5

Testcase #534.01 us40 KBAcceptedScore: 5

Testcase #634.26 us40 KBAcceptedScore: 5

Testcase #736.28 us40 KBAcceptedScore: 5

Testcase #837.04 us40 KBAcceptedScore: 5

Testcase #945.8 us40 KBAcceptedScore: 5

Testcase #1047.39 us40 KBAcceptedScore: 5

Testcase #1136.27 us40 KBAcceptedScore: 5

Testcase #1233.91 us40 KBAcceptedScore: 5

Testcase #1334.44 us40 KBAcceptedScore: 5

Testcase #1455.72 us40 KBAcceptedScore: 5

Testcase #1559.62 us40 KBAcceptedScore: 5

Testcase #1651.28 us40 KBAcceptedScore: 5

Testcase #177.896 ms40 KBAcceptedScore: 5

Testcase #187.933 ms40 KBAcceptedScore: 5

Testcase #197.918 ms40 KBAcceptedScore: 5

Testcase #208.079 ms40 KBAcceptedScore: 5


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