Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long a, b, cnt = 0, x, r;
  7. cin>>b;
  8. while(b)
  9. {
  10. cin>>a;
  11. x = a;
  12. if(a)
  13. {
  14. while(b)
  15. {
  16. r = x % b;
  17. x = b;
  18. b = r;
  19. }
  20. if(x==1) cnt++;
  21. }
  22. b = a;
  23. }
  24. cout<<cnt;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement