Skip to content

Instantly share code, notes, and snippets.

@tarik02
Created November 7, 2018 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarik02/30e76e70d0097d1bceb80e4a37b48b48 to your computer and use it in GitHub Desktop.
Save tarik02/30e76e70d0097d1bceb80e4a37b48b48 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
ifstream in("input.txt");
ofstream out("output.txt");
int main() {
ull n;
in >> n;
if (n == 4) {
out << "NO" << endl;
return 0;
}
ull k = n;
for (ull i = 2; i * i <= n; ++i) {
if (n % i == 0) {
ull b = n / i;
if (k % i == 0) {
k /= i;
}
if (k % b == 0) {
k /= b;
}
}
}
out << ((k == 1) ? "YES" : "NO") << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment