Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- #include <cmath>
- #include <sstream>
- #include <queue>
- using namespace std;
- long long gcd05(long long a, long long b) {
- while (b) {
- if (a > b) {
- long long tmp = a;
- a = b;
- b = tmp;
- }
- b %= a;
- }
- return a;
- }
- vector<long long>k;
- vector<long long> l;
- void O(long long n)
- {
- int sc = 0;
- for (int i = 1; i <= sqrt(n); i++)
- {
- if (n%i == 0)
- {
- l.push_back(i);
- if(n/i!=i)
- l.push_back(n / i);
- }
- }
- }
- int main()
- {
- long long n;
- cin >> n;
- long long answ = n / 2;
- O(n);
- for (int i = 0; i < l.size(); i++)
- {
- for (int j = i + 1; j < l.size(); j++)
- {
- if (gcd05(l[i], l[j]) == 1)
- answ++;
- }
- }
- if (n == 1)
- cout << 1;
- else
- cout << answ+1;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment