考试时候所有样例都过了,再打倒是不对了,谁能帮我看一看

P11228 [CSP-J 2024] 地图探险

yanghaoyu123 @ 2024-10-26 16:59:37

#include <iostream>
using namespace std;
int main(){
    int T;
    cin>>T;
    for (int i=0;i<T;i++){
        int n,m,k,c=1;
        cin>>n>>m>>k;
        int x,y,d;
        cin>>x>>y>>d;
        char arr[n+1][m+1];
        for (int i=1;i<=n;i++){
            for (int j=1;j<=m;j++){
                cin>>arr[i][j];
            }
        }
        for (int i=0;i<=n;i++){
            for (int j=0;j<=m;j++){
                cout<<arr[i][j];
            }
            cout<<endl;
        }
        arr[x][y]=='1';
        for (int k1=0;k1<k;k1++){
            if (d==0){
                if (arr[x][y+1]=='.'){
                    c+=1;
                    y+=1;
                    arr[x][y]='1';
                }
                else if (arr[x][y+1]=='1'){
                    y+=1;
                }
                else{
                    d+=1;
                    d%=4;
                }
            }
            else if (d==1){
                if (arr[x+1][y]=='.'){
                    c+=1;
                    x+=1;
                    arr[x][y]='1';
                }
                else if (arr[x+1][y]=='1'){
                    x+=1;
                }
                else{
                    d+=1;
                    d%=4;
                }
            }
            else if (d==2){
                if (arr[x][y-1]=='.'){
                    c+=1;
                    y-=1;
                    arr[x][y]='1';
                }
                else if (arr[x][y-1]=='1'){
                    y-=1;
                }
                else{
                    d+=1;
                    d%=4;
                }
            }
            else if (d==3){
                if (arr[x-1][y]=='.'){
                    c+=1;
                    x-=1;
                    arr[x][y]='1';
                }
                else if (arr[x-1][y]=='1'){
                    x-=1;
                }
                else{
                    d+=1;
                    d%=4;
                }
            }
        }
        cout<<c<<endl;
    }
}

by XHT911 @ 2024-10-26 17:06:18

 arr[x][y]=='1';

这是什么0-0


by XHT911 @ 2024-10-26 17:06:57

@XHT911 赋值用=

应该是arr[x][y]=1?


by hjb13357896690 @ 2024-10-26 17:28:25

@yanghaoyu123 你是杨浩宇吗


by linrun0504 @ 2024-10-26 17:42:04

@XHT911 what!!!


by XHT911 @ 2024-10-26 17:44:26

@linrun0504

0-0?咋啦

(我没说错吧...?)


by linrun0504 @ 2024-10-26 17:46:21

@XHT911 我的第三道题可能G了


by XHT911 @ 2024-10-26 17:50:13

@linrun0504

我骗分未遂..民间数据全WA了=-=


by yanghaoyu123 @ 2024-10-26 18:00:18

@XHT911 不小心多打了一个,谢谢


by yanghaoyu123 @ 2024-10-26 18:00:54

@hjb13357896690 对,你认识我?


by yanghaoyu123 @ 2024-10-26 18:04:50

@XHT911 改了,还是不对


| 下一页