#include <stdio.h> #include <Windows.h>
bool diff(char *str) { int n[10] = {0}; while (*str != '\0') { if (n[*str - '0'] == 1) return false; n[*str - '0']++; str++; } return true; }
bool diff(char *str1, char *str2) { while (*str2 != '\0') { if (strchr(str1, *str2) != NULL) return false; str2++; } return true; }
int main(void) { ULONGLONG i, n; char si[20]; char ni[20]; for (i = 100000UL; i <= 999999UL; i++) { n = i * i; sprintf_s(si, "%I64u", i); if (!diff(si)) continue; sprintf_s(ni, "%I64u", n); if (diff(si, ni)) puts(si); } return 0; }
|