solution
cpp
#include<iostream>
using namespace std;
const int maxn = 510;
int arr[maxn][maxn];
int main(){
int n, m, a, b, x;
scanf("%d%d%d%d%d", &m, &n, &a, &b, &x);
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
scanf("%d", &arr[i][j]);
if(arr[i][j] >= a && arr[i][j] <= b) arr[i][j] = x;
}
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
printf("%03d", arr[i][j]);
if(j != n - 1) printf(" ");
}
if(i != m - 1) printf("\n");
}
return 0;
}
or
cpp
#include<iostream>
using namespace std;
int main(){
int n, m, a, b, x, t;
scanf("%d%d%d%d%d", &m, &n, &a, &b, &x);
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
scanf("%d", &t);
if(t >= a && t <= b) t = x;
printf("%03d", t);
if(j != n - 1) printf(" ");
}
if(i != m - 1) printf("\n");
}
return 0;
}