Lucian_Adrian

#409 – Oglindit4

Nov 2nd, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n , x , y ,ogl , r, rez = 0;
  6.  
  7. cin >> n;
  8. for(int i = 1 ; i <= n ; ++i)
  9. {
  10. cin >> x;
  11. y = x, ogl = 0;
  12. while(y)
  13. ogl = 10 * ogl + y %10 , y /= 10;
  14. while(x % ogl){
  15. r = x % ogl;
  16. x = ogl;
  17. ogl = r;
  18. }
  19. if(ogl == 1)
  20. rez ++;
  21. }
  22. cout << rez;
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment