先枚举了9种情况 2000行代码 调整字符数交上了 马少了情况 重写 查了一天的错 发现是输入不对 |%c + getchar()| 改成|%s|就过了
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX_SIZE 11
typedef struct
{
char ch;
int x;
}Chessman;
int Calculate(Chessman Chess[][MAX_SIZE],int black_x,int black_y,int red_y);
int Calculate_General(Chessman Chess[][MAX_SIZE],int black_x,int black_y,int red_y);
int Calculate_Chariot(Chessman Chess[][MAX_SIZE],int black_x,int black_y,int red_y);
int Calculate_Cannon(Chessman Chess[][MAX_SIZE],int black_x,int black_y,int red_y);
int Calculate_Horse(Chessman Chess[][MAX_SIZE],int black_x,int black_y,int red_y);
int main()
{
Chessman Chess[MAX_SIZE][MAX_SIZE];
int black_x,black_y,red_x,red_y,result,result1,result2,result3,result4;
int N,i,x,y;
char ch[10];
while(1)
{
for(x=1;x<=10;x++)for(y=1;y<=10;y++){Chess[x][y].x=0;Chess[x][y].ch='\0';}
memset(ch,0,sizeof(ch));
scanf("%d %d %d",&N,&black_x,&black_y);if(N==0&&black_x==0&&black_y==0)return 0;
Chess[black_x][black_y].x=2;
for(i=1;i<=N;i++)
{
scanf("%s%d%d",ch,&x,&y);getchar();
if(ch[0]=='G'){Chess[x][y].x=1;Chess[x][y].ch='G';red_x = x;red_y &
版权声明:本文为qingshicanhu1原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。