注意
代码
#include <iostream>
using namespace std;
int a;
void print(int arr[]){
bool tag = false;
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
if(i==j) continue;
if(!tag){
printf("%d", a*100+arr[i]*10+arr[j]);
tag = true;
}else{
printf(" %d", a*100+arr[i]*10+arr[j]);
}
}
if(i ==2) printf("\n");
}
}
int main(){
scanf("%d", &a);
int arr[3] = {a+1, a+2, a+3};
print(arr);
a++;
arr[0] = a - 1;
arr[1] = a + 1;
arr[2] = a + 2;
print(arr);
a++;
arr[0] = a - 2;
arr[1] = a - 1;
arr[2] = a + 1;
print(arr);
a++;
arr[0] = a - 3;
arr[1] = a - 2;
arr[2] = a - 1;
print(arr);
return 0;
}
网友评论