Răspuns:
#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
int main()
{
int n,x,mini=INT_MAX,maxi=INT_MIN;
cin>>n;
for(int i = 1; i <= n; i++)
{
cin>>x;
if(x < mini)
mini = x;
if(x > maxi)
maxi = x;
}
while(mini)
{
int r = maxi % mini;
maxi = mini;
mini = r;
}
if(maxi != 1)
cout<<"NU"<<endl;
else
cout<<"DA"<<endl;
return 0;
}