Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int t;
  7.     cin >> t;
  8.     for (int w = 0; w < t; w++)
  9.     {
  10.         int a, b;
  11.         cin >> a >> b;
  12.  
  13.         int num = 0;
  14.  
  15.         if (b % a == 0)
  16.         {
  17.             num++;
  18.             int c = b / a;
  19.             int x = 2;
  20.             while (c != 1)
  21.             {
  22.                 if (c % x == 0)
  23.                 {
  24.                     num++;
  25.                     c /= x;
  26.                 }
  27.                 else
  28.                     x++;
  29.             }
  30.         }
  31.  
  32.         cout << num << endl;
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement