Pagini recente » Cod sursa (job #1863230) | Cod sursa (job #2951783) | Cod sursa (job #2341525) | Cod sursa (job #1578193) | Cod sursa (job #2557973)
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
ifstream f("nivele.in");
ofstream g("nivele.out");
// Seria borderlands e cea mai naspa din toata istoria gaming-ului, can't change my mind
stack <int> steve;
int main()
{
int ciururi;
f>>ciururi;
for (int i = 1; i <= ciururi; i++)
{
int n,x;
f>>n;
for (int j = 1; j <= n; j++)
{
f>>x;
steve.push(x);
}
int el1,el2,ok=1;
while (steve.top() != 1)
{
el1=steve.top();
steve.pop();
el2=steve.top();
steve.pop();
if (el1 == el2)
{
steve.push(el1-1);
}
else
{
ok=0;
break;
}
}
if (steve.top() == 1)
g<<"DA";
else
g<<"NU";
g<<'\n';
}
return 0;
}