Codeforces 898B - Proper Nutrition Solution
Explain:link
Solution in C++:
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,a,b,i,x,y;
- cin>>n>>a>>b;
- for(i=0;i*a<=n;i++)
- {
- if((n-i*a)%b==0)
- {
- x=i;
- y=(n-i*a)/b;
- cout<<"YES"<<endl;
- cout<<x<<" "<<y<<endl;
- return 0;
- }
- }
- cout<<"NO"<<endl;
- }
No comments