虽然解出来了 但是有个问题不明白
https://pintia.cn/problem-sets/994805260223102976/problems/994805266514558976
为什么代码1是超时的 代码2是不超时的 把代码1改为代码3又不超时了? 如果说是cin和scanf的问题 为啥代码2不超时?
代码1
#include <iostream>
using namespace std;
int main(){
int M, N, A, B, aim, tmp;
cin >> M >> N >> A >> B >> aim;
for(int i = 0; i < M; i++){
for(int j = 0; j < N; j++){
cin >> tmp;
tmp = (tmp >= A && tmp <= B) ? aim : tmp;
if(j != 0) printf(" ");
printf("%03d", tmp);
}
printf("\n");
}
return 0;
}
代码2
#include <iostream>
using namespace std;
int picture[500][500];
int main(){
int M, N, A, B, aim, tmp;
cin >> M >> N >> A >> B >> aim;
for(int i = 0; i