好,这是一道黄题。几个月前(2017.10.29)的我拿了可怜的20分。

这是当年的蒟蒻代码

 1 #include <cstdio>
 2 #include <iostream>
 3 #include <cstring>
 4 #include <algorithm>
 5 #include <cstdlib>
 6 using namespace std;
 7 
 8 int n,b,c;
 9 int a[201];
10 
11 int xiuxi(int now,int k)
12 {
13     if(k>200) return -1;
14     int aa=9999,bb=9999;
15     if(now == c) return k;
16 
17     if(now+a[now]<=n)
18     {
19         aa=xiuxi(now+a[now],k+1);
20     }
21     if(now-a[now]>0)
22     {
23         bb=xiuxi(now-a[now],k+1);
24     }
25     ///return ???;
26 }
27 
28 int main()
29 {
30     scanf ("%d%d%d",&n,&b,&c);
31     for(int i=1;i<=n;i++)
32     {
33         scanf ("%d",&a[i]);
34     }
35 
36     int ans=xiuxi(b,0);
37     printf("%d",ans);
38     return 0;
39 }
蒟蒻代码

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-11-03
  • 2021-06-19
  • 2021-06-29
  • 2022-12-23
猜你喜欢
  • 2020-05-01
  • 2021-12-07
  • 2021-07-06
  • 2021-07-22
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案