Advertisement
a53

Crescator1

a53
Jan 6th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int x,y,n=1;
  7. ifstream f("crescator1.in");
  8. f>>x;
  9. ofstream g("crescator1.out");
  10. while(f>>y)
  11. {
  12. if(y!=x)
  13. if(n%2)
  14. {
  15. g<<x;
  16. return 0;
  17. }
  18. else
  19. x=y,n=1;
  20. else
  21. x=y,++n;
  22. }
  23. if(n%2)
  24. g<<y;
  25. else
  26. g<<"nu exista";
  27. f.close();
  28. g.close();
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement