結果
| 問題 |
No.1585 Cubic Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-08 23:33:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 5,267 bytes |
| コンパイル時間 | 1,763 ms |
| コンパイル使用メモリ | 171,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 13:45:19 |
| 合計ジャッジ時間 | 2,539 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vlli vector<long long int>
#define ll long long
#define ull unsigned long long
#define For(i, k, n) for (int i = k; i < n; i++)
#define Forll(i, k, n) for (long long int i = k; i < n; i++)
#define Forull(i, k, n) for (long long int i = k; i < n; i++)
#define rt return
#define Max 100005
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll IN=1e6;
const int maxn = 55;
bool isprime(ll int n)
{
if(n==1 || n==0)
return false;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
return false;
}
return true;
}
bool compare(const pair<int,int>&a, const pair<int,int>&b)
{
return (a.second>b.second);
}
int ceils(int a,int b)
{
return (a+b-1)/b;
}
bool isSquare(int n)
{
double x=sqrt(n);
if(ceil(x)==floor(x))
return true;
return false;
}
ll int fact(int n)
{
if(n==0 || n==1)
return 1;
return n*fact(n-1);
}
inline ull gcd(ull a, ull b){
return (b == 0)? a:gcd(b, a%b);
}
inline ull lcm(ull a,ull b){
return (a*b)/gcd(a,b);
}
long long binpow(long long a, long long b) {
if (b == 0)
return 1;
long long res = binpow(a, b / 2);
if (b % 2)
return res * res * a;
else
return res * res;
}
long long binpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
bool isInteger(float a)
{
if(ceil(a)==floor(a))
return true;
return false;
}
string toBinary(int n)
{
string ans="";
while(n>0)
{
int d=n%2;
if(d==1) ans+='1';
else ans+='0';
n/=2;
}
reverse(ans.begin(),ans.end());
return ans;
}
ll int binarySearch(ll int arr[],ll int l,ll int r,ll int x)
{
while (l <= r) {
ll int m = l + (r - l) / 2;
// Check if x is present at mid
if (arr[m] ==x)
return m;
// If x greater, ignore left half
if (arr[m] < x)
l = m + 1;
// If x is smaller, ignore right half
else
r = m - 1;
}
// if we reach here, then element was
// not present
return -1;
}
ll int comb(ll int n,ll int r)
{
return fact(n)/(fact(n-r)*fact(r));
}
bool checkperi(int i,int j,int r,int c)
{
return (i>=0 && j>=0 && i<r && j<c);
}
bool isSubseq(string s1,string s2,int m,int n)
{
if(m==0) return true;
if(n==0) return false;
if(s1[m-1]==s2[n-1]) return isSubseq(s1,s2,m-1,n-1);
return isSubseq(s1,s2,m,n-1);
}
bool perfectCube(ull int N)
{
ull int cube_root;
cube_root = round(cbrt(N));
// If cube of cube_root is equals to N,
// then print Yes Else print No
if (cube_root * cube_root * cube_root == N) {
return true;
}
return false;
}
void solve()
{
ull int n;
cin>>n;
if(perfectCube(n))
{
cout<<"Yes"<<"\n";
rt;
}
cout<<"No"<<"\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ll int tc = 1;
//cin >> tc;
for (ll int t = 1; t <= tc; t++)
{
//cout << "Case #" << t << ": ";
solve();
}
}