题解 | #二维数组操作#
二维数组操作
http://www.nowcoder.com/practice/2f8c17bec47e416897ce4b9aa560b7f4
#include<stdio.h>
int main(){
int m_h,n_l,change_h1,change_l1,change_h2,change_l2,input_h,input_l,look_h,look_l;
int yes=0,no=-1;
while(scanf("%d%d%d%d%d%d%d%d%d%d",&m_h,&n_l,&change_h1,&change_l1,&change_h2,&change_l2,&input_h,&input_l,&look_h,&look_l)==10){
//问题一:建立表格
if((m_h<=9)&&(n_l<=9))
printf("%d\n",yes);
else printf("%d\n",no);
//问题二:交换
int count=0;
if((change_h1<m_h)&&(change_h1>=0)){
if((change_h2<m_h)&&(change_h2>=0)){
if((change_l1<n_l)&&(change_l1>=0)){
if((change_l2<n_l)&&(change_l2>=0))
count=1;
}
}
}
if(count==1)
printf("%d\n",yes);
else printf("%d\n",no);
//问题三:插入行
if(m_h+1<=9&&input_h<m_h)
printf("%d\n",yes);
else printf("%d\n",no);
//问题四:插入列
if(n_l+1<=9&&input_l<n_l)
printf("%d\n",yes);
else printf("%d\n",no);
//问题五:查询
if((look_h<m_h)&&(look_h>=0)){
if((look_l<n_l)&&(look_l>=0))
printf("%d\n",yes);
else printf("%d\n",no);
}
else printf("%d\n",no);
}
}