20分求助
  • 板块P1176 路径计数2
  • 楼主_O__o_
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/11/17 21:30
  • 上次更新2023/10/27 02:36:04
查看原帖
20分求助
741120
_O__o_楼主2022/11/17 21:30
/***********************************
            .-'''''-.
          .'         `.
         :             :
        :               :
        :      _/|      :
         :   =/_/      :
          `._/ |     .'
       (   /  ,|...-'
        \_/^\/||__
     _/~  `""~`"` \_
  __/  -'/  `-._ `\_\__
/     /-'`  `\   \  \-.\
*************************************/

#include<bits/stdc++.h>

using namespace std;
typedef long long ll ;
typedef int ii ;
typedef char cc ;
typedef double dd ;
typedef bool bb ;
ii arr[10000][10000];
bb pd(int i){
	if(i < 1) return false;
	else return true;//对于是否有障碍的判断 
}
int main() {
	//step 1. 读题、声明变量
	ii xx,yy;//实时侦测 
	ii bc,za;//边长与障碍数 
	ii x,y;//障碍所在的坐标(x,y) 
	//step 2. 输入
	cin >> bc >> za; 
	//step 3. 处理
	for(int i = 0;i < za;i++){
		cin >> x >> y;
		arr[x][y] = -999;
	}//障碍 
	for(int i = 0;i < bc;i++){
		for(int j = 0;j <bc;j++){
			if(pd(arr[i][j]) == false) arr[i][j] = 1;
		}
	}//初始化
	for(int i = 1;i < bc;i++){
		for(int j = 1;j < bc;j++){
			xx = arr[i - 1][j];
			yy = arr[i][j - 1];
			if(pd(xx) == true && pd(yy) == true) arr[i][j] = xx + yy;
		}//处理 
	} 
	
	//step 4. 输出
//	for(int i = 0;i < bc;i++){
//		for(int j = 0;j < bc;j++){
//			cout <<arr[i][j] << ' ';
//		}
//		cout << endl;
//	} 
 	cout << arr[bc - 1][bc - 1];
	return 0;
}




2022/11/17 21:30
加载中...