10 条题解

  • 1
    @ 2025-12-28 13:54:12
    #include <iostream>
    using namespace std;
    short ans;
    int main()
    {
    	int m,x,y,z;
    	cin >> m >> x >> y >> z;
    	for (int i = 0;i <= m / x;i++)
    	{
    		for (int j = 0;j <= m;j++)
    		{
    			int mon = m - i * x - j * y;
    			if (mon * z + i + j == m)
    			{
    				cout << i << ' ' << j << ' ' << mon * z << endl;
    				ans++;
    			}
    		}
    	}
    	cout << ans;
    	return 0;
    }

    信息

    ID
    924
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    674
    已通过
    301
    上传者