You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用C++暴力算法解决硬币分配机器谜题?期末项目求助

求助完善C++暴力算法代码(便士分配机问题)

这是我的期末项目,截止日期只剩几天,我正尝试用C++暴力算法解决便士分配机问题。以下是我写的未完成代码,请求帮忙完善:

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{ 
    int n;
    int x;
    cout << "enter the amount of coins" << endl;
    cin >> n;
    cout << "Enter size of array:" << endl;
    cin >> x;
    int* a = new int(x);
    a [0] = n;
    for (int i = 1; i < x; i++) {
    a[i] = 0;

内容的提问来源于stack exchange,提问作者user19794843

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 03:18:15