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