Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- char pesel[11][n];
- if (n >= 100) return 0;
- for(int i=n;i>0;i--){
- for (int x=11;x>0;x--){
- cin >> pesel[11-x][n-i];
- }
- }
- for(int y=n;y>0;y--){
- static int reszta = 0;
- 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);
- 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"
- if(reszta%10==0)cout <<"D\n"; else cout << "N\n";
- reszta=0;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment