打表后发现答案都是完全平方数,直接输出即可.
#include <cstdio> #include <algorithm> using namespace std; int main() { long long n; scanf("%lld",&n); for(long long i=1;i*i<=n;++i) printf("%lld ",(long long)i*i); return 0; }
打表后发现答案都是完全平方数,直接输出即可.
#include <cstdio> #include <algorithm> using namespace std; int main() { long long n; scanf("%lld",&n); for(long long i=1;i*i<=n;++i) printf("%lld ",(long long)i*i); return 0; }