竞赛首页 / 个人主页
牛客599743093号 关注 私信
#include <stdio.h> int n, a[15], ans = 0; int b[15], used[15]; // 当前选了 k 个,放在 b[0..k-1] void dfs(int k, long long now) { if (k > 0 && now == 100000) ans++; // 选下一个数 for (int i = 0; i < n; i++) { if (used[i]) continue; used[i] = 1; b[k] = a[i]; if (k == 0) dfs(k+1, a[i]); else { dfs(k+1, now + a[i]); // + dfs(k+1, now * a[i]); // * } used[i] = 0; } } int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); dfs(0, 0); printf("%d", ans); return 0; }
Rating
Rating排名
2 / 2
关注/粉丝
26
题已挑战
20
题已通过
65
次提交
运行ID 题目
得分 运行时间(ms) 使用内存(KB) 代码长度
提交时间
82918480 十万,哈哈哈,十万 运行超时 53.33 3001 0 717 C++ 2026-03-22 16:30:30
82918446 十万,哈哈哈,十万 运行超时 60 3001 0 717 C++ 2026-03-22 16:29:33
82918225 十万,哈哈哈,十万 运行超时 56.67 3001 0 717 C++ 2026-03-22 16:24:28
82911992 和异位 答案正确 100 21 776 471 C++ 2026-03-22 14:14:57
82911909 和异位 答案错误 0 23 792 471 C++ 2026-03-22 14:13:07
82911146 短学期实践 答案正确 100 69 1352 228 C++ 2026-03-22 13:57:18
82911025 小学数学题 答案正确 100 14 600 372 C++ 2026-03-22 13:54:43
82910605 奶龙大战贝利亚 Ⅱ 答案正确 100 40 660 254 C++ 2026-03-22 13:44:50
82910199 短学期实践 答案错误 50 77 1408 301 C++ 2026-03-22 13:35:36
82909974 短学期实践 答案错误 50 73 1424 314 C++ 2026-03-22 13:29:53