Advertisement
hopingsteam

Untitled

Apr 7th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.in");
  7.  
  8. int main()
  9. {
  10. int ap = 0;
  11. int nr1, nr2;
  12. fin >> nr1;
  13. while(fin >> nr2)
  14. {
  15. if(nr1 == nr2)
  16. ap++;
  17. else
  18. {
  19. if(ap == 1)
  20. cout << nr1 << " ";
  21. ap = 0;
  22. }
  23. nr1 = nr2;
  24. }
  25. if(ap == 1)
  26. cout << nr1 << " ";
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement