Răspuns :
C++:
#include <iostream>
using namespace std;
int main(){
int z, l, a, chk1, chk2, chk3;
cin>>z>>l>>a;
chk1 = (l>0 && l<13 && a>0 && z>0 && z<=31);
//Prima verificare - verificam daca luna si anul e ok, si daca ziua se incadreaza in limitele max si min
chk2 = ( (l==1||l==3||l==5||l==7||l==8||l==10||l==12) && z<=31 || (l==2||l==4||l==6||l==9||l==11) && z<=30 );
//Aci verificam fiecare luna in parte daca nu cumva depaseste limita de zile
chk3 = ( l!=2 || ( (a%400==0 || a%4==0 && a%100!=0) && z<=29 || !(a%400==0 || a%4==0 && a%100!=0) && z<=28 ));
//Aci verificam luna februarie, cu anul bisect si toate chestiile
if(chk1 && chk2 && chk3) cout<<"DA";
else cout<<"NU";
}
//++ Atasat
Regex: (probably you won't need it, but it's the best way)
^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
PHP:
<?php
$z = $_GET['z'];
$l = $_GET['l'];
$a = $_GET['a'];
echo checkdate($l, $z, $a)?"DA":"NU";
#include <iostream>
using namespace std;
int main(){
int z, l, a, chk1, chk2, chk3;
cin>>z>>l>>a;
chk1 = (l>0 && l<13 && a>0 && z>0 && z<=31);
//Prima verificare - verificam daca luna si anul e ok, si daca ziua se incadreaza in limitele max si min
chk2 = ( (l==1||l==3||l==5||l==7||l==8||l==10||l==12) && z<=31 || (l==2||l==4||l==6||l==9||l==11) && z<=30 );
//Aci verificam fiecare luna in parte daca nu cumva depaseste limita de zile
chk3 = ( l!=2 || ( (a%400==0 || a%4==0 && a%100!=0) && z<=29 || !(a%400==0 || a%4==0 && a%100!=0) && z<=28 ));
//Aci verificam luna februarie, cu anul bisect si toate chestiile
if(chk1 && chk2 && chk3) cout<<"DA";
else cout<<"NU";
}
//++ Atasat
Regex: (probably you won't need it, but it's the best way)
^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
PHP:
<?php
$z = $_GET['z'];
$l = $_GET['l'];
$a = $_GET['a'];
echo checkdate($l, $z, $a)?"DA":"NU";