swusoj(将军鬼上身啦!(0324))

来源:互联网 发布:房琪 巴基斯坦 知乎 编辑:程序博客网 时间:2024/04/29 12:10
#include<stdio.h>#include<iostream>#include<string.h>#include<math.h>#include<algorithm>using namespace std;int fina, n, st;//终点,步数,起点int ans;int main(){while (cin >> fina >> n >> st){int dp[105][2];memset(dp, 0, sizeof(dp));dp[st][0] = 1;int d = 1;for (int i = 0; i < n; i++){for (int j = 1; j <= 100; j++){dp[j][d] = dp[j - 1][1 - d] + dp[j + 1][1 - d];}d = 1 - d;}cout<<dp[fina][1-d]<<endl;}return 0;}

0 0
原创粉丝点击