#include #define u_int64 unsigned long long u_int64 ori_pow(u_int64 base, u_int64 num) { u_int64 ans = 1; u_int64 i = num; while (num != 0) { ans = ans * base; num--; } return ans; } int main(int argc, char* argv[]) { u_int64 n = 0; u_int64 z = 0; u_int64 ans = 0; u_int64 maxSize = 0; scanf("%lld%lld", &n, &z); ans = ori_pow(z, n); maxSize = ori_pow(10, 6); if (n < 0 || 100 < n || z < 0 || maxSize < ans) { printf("No"); return 0; } int x = 1; int y = 1; u_int64 check = 0; char isOK = 0; // yes = 1, no = 0 while (!isOK) { y = 1; check = 0; if (maxSize < ori_pow(x, n)) { break; } while (check < ans) { check = ori_pow(x, n) + ori_pow(y, n); if (check == ans) { isOK = 1; break; } y++; } x++; } if (isOK) { printf("Yes"); } else { printf("No"); } return 0; }