哪位神犇能解释一下这段代码

P1028 [NOIP2001 普及组] 数的计算

orz我也没看懂
by t162 @ 2019-02-16 10:59:01


二分嫌疑
by _Misaka_Mikoto @ 2019-02-16 11:00:07


。。。
by caek @ 2019-02-16 11:00:15


暴力递归!
by _Misaka_Mikoto @ 2019-02-16 11:00:51


https://vegetabird.blog.luogu.org/solution-p1028
by _Misaka_Mikoto @ 2019-02-16 11:01:19


老师刚刚说这段代码不对。。
by caek @ 2019-02-16 11:01:58


@[caek](/space/show?uid=110705) 我也觉得不对
by t162 @ 2019-02-16 11:02:43


``` #include <bits/stdc++.h> using namespace std; int n,s=0; void er(int n) { for (int i=1; i<=n/2; i++) { s++; er(n); } return; } int main() { cin>>n; er(n); cout<<s; return 0; } ```
by caek @ 2019-02-16 11:02:45


递归加~~循环的二分~~
by juruojjl_ @ 2019-02-16 11:02:59


@[caek](/space/show?uid=110705) ```cpp #include <bits/stdc++.h> using namespace std; int n,s=0,i; void er(int i) { for (int j=1; j<=i/2; j++) { s++; er(j); } return; } int main() { cin>>n; er(i); cout<<s; return 0; } ```
by t162 @ 2019-02-16 11:03:26


| 下一页