Summer Training (4) Fifth Bullet --- number theory (hdu1222) and number theory hdu1222

Source: Internet
Author: User

Summer Training (4) Fifth Bullet --- number theory (hdu1222) and number theory hdu1222

Summary of the question: after that day, you can say that it is almost A three-inch building.
At last, there was no dead face, but a dead fish eye. There are signs of point recovery. But this guy from Mencius
The words are still a bit reasonable, and the sky will fall... in short, due to the incomplete
Cheng, but Mr. A has not appeared yet, and the head of the FFF regiment will catch you with the seven holy fire orders first.
In addition to low intelligence, mechanized troops can be said to be impeccable.
This is exactly what you need to use to hide from them.


Problem Analysis: first, gcd (n, m) is obtained using the moving phase division. If n> m, gcd (n, m) is one to escape.
Otherwise, it cannot be escaped.

 

 

1 # include "cstdio" 2 3 int main () 4 {5 int m, n, t, x; 6 scanf ("% d", & t ); 7 while (t -- & scanf ("% d", & n, & m) 8 {9 while (n % m! = 0) 10 {11 x = m; 12 m = n % m; 13 n = x; 14} 15 if (n> = m) 16 printf ("% s \ n", m = 1? "NO": "YES"); 17 else18 printf ("% s \ n", m = 1? "YES": "NO"); 19} 20 return 0; 21} View Code

 

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.