| 比赛 |
2026初中综合小练习 |
评测结果 |
TAAAAAATTT |
| 题目名称 |
传球游戏 |
最终得分 |
60 |
| 用户昵称 |
2_16鸡扒拌面 |
运行时间 |
6.002 s |
| 代码语言 |
C++ |
内存使用 |
3.54 MiB |
| 提交时间 |
2026-04-14 20:06:33 |
显示代码纯文本
#include<bits/stdc++.h>
#define MAXN 100010
#define ll long long
using namespace std;
int n,m,ans=0;
int calc(int x,int v)
{
if(x==1&&v==-1) return n;
if(x==n&&v==1) return 1;
return x+v;
}
void DFS(int x,int t)
{
//if(x==1&&t!=1&&t%n%2) return ;
if(t==m)
{
if(x==1) ans++;
return ;
}
DFS(calc(x,1),t+1);
DFS(calc(x,-1),t+1);
return ;
}//3 5 10 3 6 22
int main()
{
freopen("ballg.in","r",stdin);
freopen("ballg.out","w",stdout);
cin>>n>>m;
DFS(1,0);
cout<<ans;
return 0;
}