AcWing每日一题-2022-4-11

题目链接:https://www.acwing.com/problem/content/1844/

个人题解:暴力枚举即可

代码:

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int x,y,m,res;

int main()
{
    cin>>x>>y>>m;
    for(int i=0;i*x<=m;i++)
    {
        for(int j=0;i*x+j*y<=m;j++)
        {
            res=max(res,i*x+j*y);
        }
    }
    cout<<res<<endl;
    return 0;
}
posted @ 2022-04-18 14:12  黑VS白-清墨  阅读(21)  评论(0)    收藏  举报