- 2025中级班期中测试
c题
- @ 2025-11-9 9:07:11
不是输入怎么没有空格???
3 条评论
-
冉雨泽 LV 5 @ 2025-11-9 10:56:44
cpp #include<bits/stdc++.h> using namespace std; int T,n,m,k; char a[100][100]; void dfs(int x,int y,int zz,int z){ // cout<<x<<" "<<y<<" "<<zz<<" "<<z<<"\n"; if(zz>m){ return; } if(xn-1&&yn-1&&zz<=m){ k++; } int xx=x+1; int yy=y+1; if(xx<n&&a[xx][y]'.'){ if(zz!=1){ dfs(xx,y,zz,0); }else{ dfs(xx,y,zz+1,0); } } if(yy<n&&a[x][yy]'.'){ if(zz!=0){ dfs(x,yy,zz,1); }else{ dfs(x,yy,zz+1,1); } } } int main(){ cin>>T; for(int p=0;p<T;p++){ cin>>n>>m; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; } } dfs(0,0,0,-1); cout<<k<<"\n"; k=0; } }
-
@ 2025-11-9 9:52:48
我都在写E题了,你真快。
-
@ 2025-11-9 9:51:35
为什么要有???
- 1