Guest User

Untitled

a guest
Jun 21st, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cin >> n;
  7. char pesel[11][n];
  8. if (n >= 100) return 0;
  9. for(int i=n;i>0;i--){
  10. for (int x=11;x>0;x--){
  11. cin >> pesel[11-x][n-i];
  12. }
  13. }
  14. for(int y=n;y>0;y--){
  15. static int reszta = 0;
  16. reszta+=(pesel[0][n-y]+pesel[1][n-y]*3+pesel[2][n-y]*7+pesel[3][n-y]*9+pesel[4][n-y]+pesel[5][n-y]*3);
  17. reszta+=(pesel[6][n-y]*7+pesel[7][n-y]*9+pesel[8][n-y]+pesel[9][n-y]*3+pesel[10][n-y]-45*48); //lub bez "-45*48", bo cyfra jedności jest "0"
  18. if(reszta%10==0)cout <<"D\n"; else cout << "N\n";
  19. reszta=0;
  20. }
  21. return 0;
  22. }
Add Comment
Please, Sign In to add comment