Untitled
raw download clone
TEXT
views 80
,
size 348 b
#include <iostream>
using namespace std;
int main()
{
	int n, a[100], i, b, c, r, k = 0;
		cin >> n;
	for (i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (i = 1; i <= n; i++)
	{
		b = a[i];
		c = a[n - 1 + 1];
		r = b % c;
		while (r != 0)
		{
			b = c;
			c = r;
			r = b % c;
			if (c == 1)
				k++;
		}
		
	}
	cout << k;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.