Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int t, s;
  8. char pesel[12];
  9. cin>>t;
  10. while(t--)
  11. {
  12. cin>> pesel;
  13.  
  14. s =
  15. (1 * pesel[0]) +
  16. (3 * pesel[1]) +
  17. (7 * pesel[2] )+
  18. (9 * pesel[3]) +
  19. (1 * pesel[4]) +
  20. (3 * pesel[5]) +
  21. (7 * pesel[6]) +
  22. (9 * pesel[7]) +
  23. (1 * pesel[8]) +
  24. (3 * pesel[9]) +
  25. (1 * pesel[10])
  26. ;
  27.  
  28. if (s%10 == 0)
  29. {
  30. cout << "D" << endl;
  31. }
  32. else
  33. {
  34. cout << "N" << endl;
  35. }
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement