👤

Vreau rezolvarea problemei din imagine!


Vreau Rezolvarea Problemei Din Imagine class=

Răspuns :

#include <bits/stdc++.h>
using namespace std;
int x, y, n, i, ct;
bool ok = true;
int main()
{
    cin >> n;
    cin >> x;
    for (i = 2; i <= n; i++)
    {
        cin >> y;
        if (y != x)
        {
            ok = false;
            break;
        }
        x = y;
    }
    if (ok) cout << "DA";
       else cout << "NU";
    return 0;
}