Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
145468 | 李树强 | 货币系统 | C++ | 通过 | 100 | 25 MS | 360 KB | 581 | 2024-05-05 09:20:45 |
#include<iostream> #include<algorithm> using namespace std; const int N = 110, M = 25010; int t, n, a[N], b[M], cnt = 0; int main(){ cin >> t; while(t--){ for(int i = 0; i < M; i++) b[i] = true; b[0] = cnt = 0; cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for(int i = 0; i < n; i++){ if(b[a[i]]){ for(int j = 0; j < M-a[i]; j++){ if(!b[j]) b[j+a[i]] = false; } cnt++; } // for(int j = 10; j <= 25; j++) cout << b[j] << ' '; // cout << endl; } cout << cnt << endl; } return 0; }