Cod sursa(job #693925)

Utilizator Cantor_paulCantor Paul Dan Cantor_paul Data 27 februarie 2012 17:43:52
Problema Nivele Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
using namespace std;
 
 ifstream f("nivele.in");
 ofstream g("nivele.out");
 
 int t, n ,v[50001];
 char *P[3];
 
 void nivele()
 {
 int i;
  f>>n;
   v[0]=0;
   for(i=1; i<=n; i++)
    f>>v[++v[0]];
     while(v[0] > 1 && v[v[0]] == v[v[0]-1])
      v[--v[0]]--;
      	if (v[0] == 1 && v[1] == 1)
	*P = "DA\n";
	else
		*P = "NU\n";
	g << *P;
}

int main()
{
	f >> t;
	while (t--)
		nivele();	
	return 0;
}