10 条题解

  • 7
    @ 2022-12-21 13:29:25

    水题。 AC代码:

    #include<iostream>
    using namespace std;
    int n;
    bool check(int x){
    	int y=x*x;
    	while(x!=0){
    		if(x%10!=y%10)return false;
    		x/=10;
    		y/=10;
    	}
    	return true;
    }
    int main(){
    	cin>>n;
    	for(int j=2;j<=n;j++){
    		if(check(j))cout<<j<<" ";
    	}
    	return 0;
    }
    

    点个赞吧!

    信息

    ID
    941
    时间
    1000ms
    内存
    32MiB
    难度
    4
    标签
    递交数
    377
    已通过
    188
    上传者