Skip to content

Instantly share code, notes, and snippets.

@nyx-rattapoom
Created February 22, 2018 09:54
Show Gist options
  • Save nyx-rattapoom/5f3b097d75544902c18f4729d35a3ac6 to your computer and use it in GitHub Desktop.
Save nyx-rattapoom/5f3b097d75544902c18f4729d35a3ac6 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
while(scanf("%d", &n) == 1) {
for(int i = 0; i*i < pow(10, n); i++){
if(pow(i*i % (int) pow(10, n / 2) + i*i / (int) pow(10, n / 2), 2) == i*i){
printf("%0*d\n", n, i*i);
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment