fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int egyjo[] = {17560, 22171, 25731, 41892, 44356, 53970, 78697, 79500, 86075, 90389, 0};
  5.  
  6. bool egy_egyezik(int szam, int masik)
  7. {
  8. int azon = 0;
  9. for (int i=0; i<5; i++) {
  10. if ((szam % 10) == (masik % 10))
  11. azon++;
  12. szam /= 10;
  13. masik /= 10;
  14. }
  15. return azon == 1;
  16. }
  17.  
  18. int main()
  19. {
  20. for (int szam = 0; szam <= 99999; szam++) {
  21. bool jo = true;
  22. for (int i=0; jo && egyjo[i]; i++) {
  23. if (!egy_egyezik(szam, egyjo[i]))
  24. jo = false;
  25. }
  26. if (jo)
  27. cout << szam << endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 4256KB
stdin
Standard input is empty
stdout
26390