👤

In C++ va rog, dau coroana!​

In C Va Rog Dau Coroana class=

Răspuns :

#include <iostream>

using namespace std;

int main()

{

int n;

cin>>n;

int c = n, prev = -1, inv = 0, l=0;

while(c!=0)

{

inv = inv * 10 + c%10;

c/=10;

l++;

}

if(inv == n){

int prev=-1;

bool munte = true;

for(int i = 0; i < l/2+l%2&&munte; i++)

{

munte = (n%10>prev);

prev = n%10;

n/=10;

}

cout << (munte?"DA":"NU");

}

else cout << "NU";

}