ss_yangzirui @ 2024-11-04 18:38:38
棋盘上
棋盘用坐标表示,
现在要求你计算出卒从
一行四个正整数,分别表示
一个整数,表示所有的路径条数。
6 6 3 3
6
对于
【题目来源】
NOIP 2002 普及组第四题
by lhz2022 @ 2024-11-04 18:39:18
@ss_yangzirui 不如直接ctj
by ss_yangzirui @ 2024-11-04 18:43:17
@lhz2022 大神科普一下ctj是什么意思?
by xC41 @ 2024-11-04 18:44:27
@ss_yangzirui 抄题解
by lhz2022 @ 2024-11-04 18:45:15
@ss_yangzirui
当然啦,如果你想学到,可以理解题解的内容
如果只要代码,直接ctrl+c ctrl+v就行
by lhz2022 @ 2024-11-04 18:45:26
@ss_yangzirui 抄题解
by lsrsrl @ 2024-11-04 18:49:03
@ss_yangzirui ```cpp
using namespace std; typedef long long ll; const int fx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2}; const int fy[] = {0, 1, 2, 2, 1, -1, -2, -2, -1};
int bx, by, mx, my; ll f[40][40]; bool s[40][40]; int main(){ scanf("%d%d%d%d", &bx, &by, &mx, &my); bx += 2; by += 2; mx += 2; my += 2; f[2][1] = 1; s[mx][my] = 1; for(int i = 1; i <= 8; i++) s[mx + fx[i]][my + fy[i]] = 1; for(int i = 2; i <= bx; i++){ for(int j = 2; j <= by; j++){ if(s[i][j]) continue; f[i][j] = f[i - 1][j] + f[i][j - 1]; } } printf("%lld\n", f[bx][by]); return 0; }
qiuguan
by ss_yangzirui @ 2024-11-04 18:49:22
@lhz2022 我试试
by ss_yangzirui @ 2024-11-04 18:51:51
@lsrsrl 谢谢!谢谢!
by ss_yangzirui @ 2024-11-04 18:52:33
谢谢帮我的大神