Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<climits>
- using namespace std;
- ifstream fin("cuburi.in");
- ofstream fout("cuburi.out");
- int main()
- {
- int cub, i, n, x;
- fin>>n;
- for(i=1; i<=n; i++)
- {
- fin>>x;
- }
- fin>>cub;
- fin.close();
- fin.open("cuburi.in", ios::in);
- fin>>n;
- for(i=1; i<=n; i++)
- {
- fin>>x;
- if(x>cub)
- {
- fout<<cub<<' ';
- cub=INT_MAX;
- }
- fout<<x<<' ';
- }
- if(cub<INT_MAX)
- {
- fout<<cub;
- }
- return 0;
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment