Ebony and Ivory Codeforces Solution

Ebony and Ivory Codeforces Solution

In this post, the Ebony and Ivory Codeforces Solution is given. Here is the Question details : Manthan, Codefest 16, problem: (A) Ebony and Ivory.

Ebony and Ivory Codeforces Solution

#include<bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
#define ll long long
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PB push_back
int main()
{
Fastio;
ll a,b,c,i,j,flag=0;
cin>>a>>b>>c;
for(i=0;i<=c;i++)
{
if(flag==0)
{
for(j=0;j<=c;j++)
{
if(((i*a)+(j*b))==c)
{
cout<<“Yes”<<endl;
flag=1;
break;
}
}
}
}
if(flag==0
cout<<“No”<<endl;
}


The solution of the above program Ebony and Ivory is contributed by Vishal Vaibhab (IIT BHU). If you like TheCode11, then do follow us on Facebook, Twitter and Instagram.

Post a Comment

Previous Post Next Post

Contact Form