HDU 1222 Wolf and rabbit

Source: Internet
Author: User

Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1222

 

After such a long time, I finally tasted some sweetness... t_t ....

In the beginning, I thought this question was another problem with Joseph's ring. I thought we could just find that if the two numbers are mutually qualitative, that is, when their maximum common number is 1, it would be no.

1 # include <stdio. h> 2 int gcd (int m, int N) 3 {4 return M = 0? N: gcd (N % m, m); 5} 6 int main () 7 {8 int T, m, n; 9 scanf ("% d", & T ); 10 while (t --) 11 {12 scanf ("% d", & M, & N); 13 if (gcd (m, n) = 1) 14 printf ("NO \ n"); 15 else16 printf ("Yes \ n"); 17} 18}

 

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.