Run ID:27647

提交时间:2022-06-07 17:57:32

#include<iostream> #include<cmath> #include<cstdio> #include<cstring> using namespace std; int main() //主函数入口 { int i = 0,j = 0,a,b,n,temp1,temp2; scanf("%d %d %d",&n,&a,&b); temp1 = a; temp2 = b; for(i = 1; i <= n ; i++) { printf("(%d,%d) ",a,i); } cout <<endl; for(i = 1; i <= n ; i++) { printf("(%d,%d) ",i,b); } cout <<endl; for(i = 0; i < n ; i++) { if(temp1==1||temp2==1) break; temp1 = temp1-1; temp2 = temp2-1; } for(i = 0; i < n ; i++) { printf("(%d,%d) ",temp1,temp2); if(temp1==n||temp2==n) break; temp1 = temp1+1; temp2 = temp2+1; } cout << endl; temp1 = a; temp2 = b; for(i = 0; i < n ; i++) { if(temp1==1||temp2==n) break; temp1 = temp1-1; temp2 = temp2+1; } for(i = 0; i < n ; i++) { printf("(%d,%d) ",temp2,temp1); if(temp1==n||temp2==1) break; temp1 = temp1+1; temp2 = temp2-1; } cout <<endl; return 0; //结束整个程序 }