22214 不找零钱

不找零钱

https://ac.nowcoder.com/acm/problem/22214

#include<iostream>
using namespace std;
int main()
{
    int a, b ,c;
    cin>>a>>b>>c;
    for(int i=0; i*a<=c; i++)
    {
        if((c-a*i)%b==0)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务