fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int TEN = 10;
  5.  
  6. int main() {
  7. int a, b, c, x;
  8. cin >> a >> b >> c >> x;
  9. int copyX = x;
  10.  
  11. int primaCifra = x;
  12. while (primaCifra >= TEN) {
  13. primaCifra /= TEN;
  14. }
  15. int numarCifre = 0;
  16. while (copyX > 0) {
  17. ++numarCifre;
  18. copyX = copyX / TEN; // eliminam ultima cifra
  19. }
  20. int reverseX = 0;
  21. while (x) {
  22. reverseX = reverseX * TEN + x % TEN;
  23. x /= TEN;
  24. }
  25. int primaCifraReverseX = reverseX;
  26. while (primaCifraReverseX >= TEN) {
  27. primaCifraReverseX /= TEN;
  28. }
  29. if ((a == numarCifre) && (b == primaCifra) && (c == primaCifraReverseX)) {
  30. cout << "DA" << endl;
  31. }
  32. else {
  33. cout << "NU" << endl;
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
NU