竞赛
考级
彭珂洋
题目分析 对 NNN 开三次根,若求得的数为整数,则是立方数。 可以用函数 cbrt,开三次根,已在 c++11中支持。 或者使用 pow 函数,求 N13N ^ {\frac{1}{3}}N31 。 AC 代码 复杂度分析 O(1)O(1)O(1)
AC君
用cbrt(开立方)和pow(幂)就可以
qi
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; bool isCube = false; for (int x = 1; x <= n; ++x) { if (x * x * x == n) { isCube = true; break; } } if (isCube) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include <bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; const int N = 1e5 + 10; int t,n,m; int main() { ios::sync_with_stdio(false); cin >> n; int k = cbrt(n); if (k * k * k == n) { cout << "YES" << endl; }else { cout << "NO" << endl; } return 0; }
郭恒驿
有事找大号
题解
Smile(吕卓然)
LS_YZY
zsy
#include<iostream> using namespace std; int main(){ int n; cin>>n; for(int i=1;iii<=n;i++){ if(iii==n){ cout<<"YES"; return 0; } } cout<<"NO"; return 0; }
吴(回关)
提交答案之后,这里将显示提交结果~