denis_andrei10

oli 1 2011 vrancea

Dec 12th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. #include<climits>
  4. using namespace std;
  5. ifstream fin("cuburi.in");
  6. ofstream fout("cuburi.out");
  7. int main()
  8. {
  9. int cub, i, n, x;
  10. fin>>n;
  11. for(i=1; i<=n; i++)
  12. {
  13. fin>>x;
  14. }
  15. fin>>cub;
  16. fin.close();
  17. fin.open("cuburi.in", ios::in);
  18. fin>>n;
  19. for(i=1; i<=n; i++)
  20. {
  21. fin>>x;
  22. if(x>cub)
  23. {
  24. fout<<cub<<' ';
  25. cub=INT_MAX;
  26. }
  27. fout<<x<<' ';
  28. }
  29. if(cub<INT_MAX)
  30. {
  31. fout<<cub;
  32. }
  33. return 0;
  34. fin.close();
  35. fout.close();
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment