fork(4) download
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int NWD (int a, int b)
  8.  
  9. {
  10. if (b!=0)
  11. return NWD(b, a%b);
  12. else (a==b);
  13. {
  14. return a;
  15. }
  16.  
  17.  
  18. return a;
  19. }
  20.  
  21.  
  22. int main()
  23. {
  24.  
  25. int a, b, ile;
  26. a !=0;
  27. b !=0;
  28. cin >> ile;
  29.  
  30.  
  31. if (ile >= 1 && ile <= 100000)
  32. {
  33.  
  34.  
  35.  
  36. for (int i = 0; i < ile; i++)
  37. {
  38. cin >>a>>b;
  39.  
  40. if (a >= 2 && a <= 1000000 && b >= 2 && b <= 1000000)
  41. {
  42. cout << NWD(a,b)<<endl;
  43. }
  44. else{
  45. return 0;
  46.  
  47. }
  48.  
  49.  
  50. }
  51.  
  52. }
  53. else{
  54. return 0;
  55. }
  56. return 0;
  57.  
  58. }
  59.  
Success #stdin #stdout 0s 15232KB
stdin
2 
1000 2000
99983 100000
stdout
1000
1