#35047:


yp11151169@yphs.tp.edu.tw (803-36)

學校 : 臺北市私立延平高級中學
編號 : 225283
來源 : [203.72.178.1]
最後登入時間 :
2023-06-15 14:06:12
d105. NOIP 2008 3.传球游戏 -- NOIP2008普及组复赛 | From: [203.72.178.1] | 發表日期 : 2023-05-04 13:22

#include <iostream> #include <cstring> using namespace std; static const auto Initialize = [] { cin.sync_with_stdio(false); cin.tie(nullptr); return nullptr; }(); int main() { int people, times, DP[30][30][31]; while (cin >> people >> times) { memset(DP, 0, sizeof(DP)); for (int i = 0; i < people; ++i) DP[i][(i + 1) % people][1] = DP[i][(i + people - 1) % people][1] = 1; for (int t = 2; t <= times; ++t) for (int i = 0; i < people; ++i) for (int j = 0; j < people; ++j) DP[i][j][t] = DP[(j + 1) % people][i][t - 1] + DP[(j + people - 1) % people][i][t - 1]; cout << DP[0][0][times] << '\n'; } }

 
ZeroJudge Forum