fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char pesel[11];
  8. int iloczyny[11] = {1,3,7,9,1,3,7,9,1,3,1};
  9. int ile;
  10. int k;
  11.  
  12. cin >> ile;
  13.  
  14. for(int z=1;z<=ile;z++)
  15. {
  16. cin >> pesel;
  17. int suma_a=0;
  18. int suma_b=0;
  19.  
  20. for(int i=0;i<11;i++)
  21. {
  22. suma_a=(pesel[i]-'0')*iloczyny[i];
  23. suma_b=suma_b+suma_a;
  24. }
  25.  
  26. k=suma_b%10;
  27. if(k==0)
  28. cout<<"D"<<endl;
  29. else
  30. cout<<"N"<<endl;
  31.  
  32. }
  33.  
  34. return 0;
  35. }
  36.  
  37.  
  38.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Standard output is empty