problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1002类 参考

洛谷 P1002 [NOIP2002 普及组] 过河卒 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1002 [NOIP2002 普及组] 过河卒

在文件 luogu.h30 行定义.

成员函数说明

◆ main()

int luogu::P1002::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp116 行定义.

116 {
117 int n;
118 int m;
119 int cx;
120 int cy;
121 cin >> n >> m >> cx >> cy;
122 unsigned long long board[21][21] = {};
123 board[0][0] = 1;
124 for(int i = 0; i <= n; i++) {
125 for(int j = 0; j <= m; j++) {
126 if(abs(cx - i) * abs(cy - j) == 2 || i == cx && j == cy) {
127 board[i][j] = 0;
128 continue;
129 }
130 if(i - 1 >= 0) {
131 board[i][j] += board[i - 1][j];
132 }
133 if(j - 1 >= 0) {
134 board[i][j] += board[i][j - 1];
135 }
136 }
137 }
138 cout << board[n][m];
139 return 0;
140 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: