fork download
  1. #include <iostream>
  2. using namespace std;
  3. using ll = long long;
  4. ll gcd(ll a, ll b) {
  5. return b ? gcd(b, a % b) : a;
  6. }
  7. int main() {
  8. ll a, b;
  9. cin >> a >> b;
  10. ll uoc = gcd(a, b);
  11. ll count = 0;
  12. for (ll i = 1; i * i <= uoc; i++) {
  13. if (uoc % i == 0) {
  14. if (i * i == uoc) count++;
  15. else count += 2;
  16. }
  17. }
  18. cout << count;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
5