为什么会零分呢?我不理解。
蒟蒻码风极差,大佬不喜勿喷
蒟蒻码风极差,大佬不喜勿喷
蒟蒻码风极差,大佬不喜勿喷
蒟蒻码风极差,大佬不喜勿喷
蒟蒻码风极差,大佬不喜勿喷
蒟蒻码风极差,大佬不喜勿喷
如果我犯了弱智错误,把我当傻逼。
#include<bits/stdc++.h>
using namespace std;
char aMap[10010][10010];
int nn,mm,kk;
int tt;
int main()
{
ios::sync_with_stdio(0);
freopen("explore.in","r",stdin);
freopen("explore.out","w",stdout);
cin>>tt;
short nowdd=0;
//0=东 1=南 2=西 3=北
int nowxx=0,nowyy=0;
int goNUM=1;
for(int i=1;i<=tt;i++)
{
cin>>nn>>mm>>kk;
cin>>nowxx>>nowyy>>nowdd;
for(int i=1;i<=nn;i++)
{
for(int j=1;j<=mm;j++)
{
cin>>aMap[i][j];//第i行第j列
}
}
//cout<<"计算开始"<<endl;
for(int i=1;i<=kk;i++)//计算
{
//cout<<endl;
//cout<<"当前i="<<i<<endl;
//已经判断了是否在地图里,因为外面不会是'.'
if(aMap[nowxx][nowyy+1]=='.'&&nowdd==0)//面向东
{
nowyy++;
goNUM++;
//cout<<"面向东走了1"<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
else if(aMap[nowxx+1][nowyy]=='.'&&nowdd==1)//面向南
{
nowxx++;
goNUM++;
//cout<<"面向南走了1"<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
else if(aMap[nowxx][nowyy-1]=='.'&&nowdd==2)//面向西
{
nowyy--;
goNUM++;
//cout<<"面向西走了1"<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
else if(aMap[nowxx-1][nowyy]=='.'&&nowdd==3)//面向北
{
nowxx--;
goNUM++;
//cout<<"面向北走了1"<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
else//转向
{
if(nowdd<=2)
{
nowdd++;
//cout<<"向右转,当前nowdd="<<nowdd<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
else
{
nowdd=0;
//cout<<"向右转,当前nowdd=0"<<endl;
//cout<<"已经走了"<<goNUM<<"步"<<endl;
//cout<<"目前位于"<<nowxx<<','<<nowyy<<endl;
}
}
}
cout<<goNUM<<endl;
}
return 0;
}