Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int numbers;
  8. int wynik[100000];
  9. int k = 0;
  10. for(;;){
  11. cin >> numbers;
  12. wynik[k] = numbers;
  13. if(numbers == 0){
  14. wynik[k] = -1;
  15. break;
  16. }
  17. int numbs[numbers];
  18. int good[numbers];
  19. int bad[numbers];
  20. int nice = 0;
  21. int notnice = 0;
  22. for(int i = 0; i < numbers; i++){
  23. cin >> numbs[i];
  24. if(numbs[i] >= 0){
  25. good[i] = numbs[i];
  26. nice++;
  27. }
  28. else{
  29. bad[i] = numbs[i]*(-1);
  30. notnice++;
  31. }
  32. }
  33. for(int i = 0; i < notnice; i++){
  34. for(int c = 0; c <= nice; c++){
  35. if(bad[i] == good[c]){
  36. wynik[k]--;
  37. break;
  38. }
  39. }
  40. }
  41. if(nice == 0){
  42. wynik[k] = 0;
  43. }
  44. k++;
  45. }
  46. for(int z = 0; z <= k; z++){
  47. if(wynik[z] == -1) break;
  48. cout << wynik[z] << endl;
  49. }
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement