//tan 1°は有理数か?を彷彿させますね #include #include #include #define int long long #define rep(i, n) for(i = 0; i < n; i++) using namespace std; signed main() { double A, B; cin >> A >> B; int siA = (int)(10000 * A); int boA = 10000; int b = (int)(10000 * B); vector pa, ea, pa2, ea2; int tmp = siA; for (int i = 2; i * i <= tmp; i++) { int cnt = 0; while (tmp % i == 0) { tmp /= i; cnt++; } pa.push_back(i); ea.push_back(cnt); } if (tmp > 1) { pa.push_back(tmp); ea.push_back(1); } pa2.push_back(2); ea2.push_back(4); pa2.push_back(5); ea2.push_back(4); map mp; for (int i = 0; i < pa.size(); i++) { ea[i] *= b; mp[pa[i]] += ea[i]; } for (int i = 0; i < pa2.size(); i++) { ea2[i] *= b; mp[pa2[i]] -= ea2[i]; } for (map::iterator it = mp.begin(); it != mp.end(); it++) { if (it->second < 0 || it->second % 10000 != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }