题解
【基础】格子问题
1 条题解
-
0
#include<bits/stdc++.h> using namespace std; int main(){ int a[100][100]; int n,x,y; cin>>n>>x>>y; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==x)cout<<"("<<i<<","<<j<<")"; } } cout<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(j==y)cout<<"("<<i<<","<<j<<")"; } } cout<<endl; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i-j==x-y)cout<<"("<<i<<","<<j<<")"; } } cout<<endl; for(int i=n;i>=1;i--){ for(int j=n;j>=1;j--){ if(i+j==x+y)cout<<"("<<i<<","<<j<<")"; } } return 0; }
- 1