fork download
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int test, suma, tab[10];
  9. char znak;
  10. cin >> test;
  11. for (int licznik=test; licznik>0; licznik--)
  12. {
  13. fflush(stdin);
  14. suma=0;
  15. for (int i=0; i<11; i++)
  16. {
  17. znak=getchar();
  18. if ((znak>47)&&(znak<58))
  19. tab[i]=(int)znak-48;
  20. }
  21. suma=(tab[0]+tab[4]+tab[8]+tab[10]+(tab[1]+tab[5]+tab[9])*3+(tab[2]+tab[6])*7+(tab[3]+tab[7])*9);
  22. if ((suma>0)&&(suma%10==0)) cout << "D" << endl;
  23. else cout << "N" << endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 15232KB
stdin
2
44051401458
12345678901
stdout
N
N