Advertisement
OnyRoman

Untitled

May 2nd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream> // 506
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n, v[100], i, oglindit = 0, x;
  7. bool a;
  8. cin >> n;
  9. for (i = 1; i <= n; i++)
  10. cin >> v[i];
  11.  
  12. // aflam oglinditul primului numar din sir
  13. x = v[1];
  14. while (x) {
  15. oglindit = oglindit * 10 + x % 10;
  16. x /= 10;
  17. }
  18.  
  19. // verificam daca sirul contine oglinditul primului numar
  20. a = false;
  21. for (i = 1; i <= n; i++) {
  22. if (v[i] == oglindit) {
  23. a = true;
  24. break;
  25. }
  26. }
  27.  
  28. if (a == true)
  29. cout << "DA";
  30. else
  31. cout << "NU";
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement