水题。
看了一下柳婼的代码,发现她是一边输入数据,一边处理后输出数据,这种方法使得代码量少了很多。
#include<iostream> using namespace std; int main() { int m,n,A,B,replace,t; cin>>m>>n>>A>>B>>replace; for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) { scanf("%d",&t); if(t>=A && t <= B) t = replace; if(j > 0) printf(" "); printf("%03d",t); } printf("\n"); } return 0; }
原文:https://www.cnblogs.com/keep23456/p/12355596.html