题解
2025-07-31 19:24:37
发布于:北京
4阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
#define V vector
#define all0(x) (x).begin(),(x).end()
#define all1(x) (x).begin()+1,(x).end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long LL;
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const int N = 100 + 20;
const int INF = 0x3f3f3f3f;
const LL INFLL =0x3f3f3f3f3f3f3f3f;
int a[N][N];
int vis[N][N];
int n , m;
int ans = INF;
LL f[N][N];
void so() {
cin >> n >> m;
for(int i = 1 ; i <= n ; i++ ){
for(int j = 1 ; j <= m ; j++ ){
if(i == 1 && j == 1) f[i][j] = 1; //只需要特判f[1][1] = 1就可以。
else f[i][j] = f[i - 1][j] + f[i][j - 1];
}
}
cout << f[n][m];
}
int main() {
IOS
int tt=1;
// cin >> tt;
while (tt--)
so();
}
这里空空如也
有帮助,赞一个