Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
146499 jiayou 货币系统 C++ 解答错误 0 26 MS 288 KB 724 2024-05-12 06:43:55

Tests(0/20):


#include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 110, M = 25000 + 10; int T, n; int v[101]; bool f[25001]; int main() { cin >> T; while (T--) { cin >> n; for (int i = 1; i <= n; i++) cin >> v[i]; sort(v + 1, v + 1 + n); int res = 0; //f[0] = true; for (int i = 1; i <= n; i++) { if (f[v[i]]==0) { res++; for(int j = v[i];j <= v[n];j++){ if(f[j-v[i]]==1){ f[j] = 1; } } } } cout << res << endl; memset(v, 0, sizeof v); memset(f, false, sizeof f); } return 0; }


测评信息: