fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Introduc variabilele a, b, c şi x;
  6. int a, b, c, x;
  7. // Citesc a, b, c, x;
  8. cin >> a >> b >> c >> x;
  9. if (c != x % 10) cout << "NU";
  10. if (c == x % 10) { // verificam "c"
  11. // Introduc variabila “cnt” sa numar cifrele;
  12. int cnt = 0;
  13. // parcurg x;
  14. int x_copy;
  15. while (x > 0) {
  16. ++cnt;
  17. x_copy = x; // identific "b" introducand o variabila copie a lui x
  18. //pentru a mentine penultima valoare a lui x
  19. x /= 10;
  20. }
  21. if (b == x_copy) {
  22. if (a == cnt)
  23. // verificam a si b
  24. cout << "DA";
  25. }
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5320KB
stdin
3 1 2 102
stdout
DA