Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream cin("remi.in");
- ofstream cout("remi.out");
- #define N_MAX 10000
- int v[N_MAX],maxv[N_MAX];
- int main()
- {
- int n,a,max1,i,j,stg,colm,col,ci;
- cin>>a>>n;
- max1=0;
- for(i=0;i<n;i++){
- cin>>v[i];
- if(v[i]>=max1){
- max1=v[i];
- ci=i;
- }
- }
- if(a<max1){
- cout<<max1;
- col=0;
- stg=1;
- while(col<n){
- if(col!=ci){
- if(stg==1 && v[col]<a){
- cout<<a;
- stg=0;
- col--;
- }else{
- cout<<v[col];
- }
- }
- col++;
- }
- if(stg==1)
- cout<<a;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement