fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a, b, c, x;
  6. cin >> a >> b >> c >> x;
  7. int a_cnt = 0;
  8. int b_copy = 0;
  9. int c_copy = x % 10;
  10. while (x > 1) {
  11. ++a_cnt;
  12. x /= 10;
  13. cout << x;
  14. }
  15. if (c == c_copy && b == b_copy && a == a_cnt) {
  16. cout << "DA";
  17. } else {
  18. cout <<"NU";
  19. }
  20. return 0;
  21. }
  22.  
  23. /* Teste:
  24.  
  25. Valori minime
  26.  
  27. 3 1 2 102 -> DA
  28.  
  29. 1 3 2 123 -> NU
  30.  
  31. Valori maxime
  32.  
  33. 9 9 9 900000009 -> DA
  34.  
  35. 9 9 9 90000009 -> NU
  36.  
  37. 9 8 7 987654321 -> NU
  38.  
  39. Numere cu toate cifrele egale
  40.  
  41. 4 4 4 4444 -> DA
  42.  
  43. 7 7 7 7777777 -> DA
  44.  
  45. 8 8 8 888888 -> NU
  46.  
  47. Numere cu toate cifrele distincte
  48.  
  49. 4 4 1 4321 -> DA
  50.  
  51. 7 5 1 7451 -> NU
  52.  
  53.  
  54.  
  55. Numere cu doua cifre identice
  56.  
  57. 4 8 8 8458 -> DA
  58.  
  59. 5 5 6 59796 -> DA
  60.  
  61. Numere cu trei cifre identice
  62.  
  63. 3 3 3 333 -> DA
  64.  
  65. 4 6 8 6888 -> DA */
Success #stdin #stdout 0s 5316KB
stdin
4 1 2 1332
stdout
133131NU