HUDJ 3270 The Diophantine Equation

Source: Internet
Author: User

HUDJ 3270 The Diophantine Equation

The Diophantine Equation Time Limit: 1000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission (s): 1133 Accepted Submission (s): 292


Problem DescriptionWe will consider a linear Diaphonic equation here and you are trying to find out whether the equation is solvable in non-negative integers or not.
Easy, is not it?
InputThere will be multiple cases. each case will consist of a single line expressing the Diophantine equation we want to solve. the equation will be in the form ax + by = c. here a and B are two positive integers expressing the co-efficient of two variables x and y.
There are spaces:
1. "ax" and '+'
2. '+' and ""
3. "by" and '='
4. '=' and "c"

C is another integer that express the result of ax + by.-1000000 OutputYou shoshould output a single line containing either the word "Yes. "or" No. "for each input cases resulting either the equation is solvable in non-negative integers or not. an equation is solvable in non-negative integers if for non-negative integer value of x and y the equation is true. there shoshould be a blank line after each test cases. please have a look at the sample input-output for further clarification.
Sample Input
2x + 3y = 1015x + 35y = 67x + y = 0

Sample Output
Yes.No.Yes.




Pay attention to the input:

#include
  
   #include
   
    using namespace std;int main(){    char s1[20],s2[20];char q,w;    int k;    while(cin>>s1>>q>>s2>>w>>k)    {        int n,m,i,j;        n=m=0;        for(i=0;i
    
     

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.