Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- short v[201];
- int main()
- {
- short n, i, a, b, c=0, r;
- cin >> n;
- for (i=1; i<=n; ++i) cin >> v[i];
- for (i=1; i<n; ++i)
- {
- a=v[i]; b=v[n];
- while (b!=0)
- {
- r=a%b; a=b; b=r;
- }
- if (a==1) ++c;
- }
- cout << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment