Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int P,n;
  5. char cod[3],ck[3];
  6. int main()
  7. {
  8. cin>>P;
  9. cin.get(cod,2);
  10. cin>>n;
  11. if(P==1)
  12. {
  13. int ns=0,nd=0,nsd=0,nb=0;
  14. for(int i=1;i<=n;i++)
  15. {
  16. cin.get(ck,2);
  17. cin>>pret;
  18. int nr=0;
  19. for(int j=0;j<=2;j++)
  20. if(cod[i]!=ck[i])
  21. nr++;
  22. if(nr==3)
  23. ns++;
  24. else
  25. {
  26. if(nr==2)
  27. nsd++;
  28. else
  29. {
  30. if(nr==1)
  31. nd++;
  32. else
  33. if(nr==0)
  34. nb++;
  35. }
  36. }
  37. }
  38. cout<<ns<<" "<<nd<<" "<<nsd<<" "nb;
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement