极简题解,不用递归也可以 摘要:解题思路:注意事项:参考代码:import java.util.Scanner;public class Main { public static void main(Str…… 题解列表 2025年02月02日 0 点赞 0 评论 65 浏览 评分:0.0
简单的递归 摘要:#include<stdio.h> int ans(int n); int main(void) { int n; scanf("%d",&n); printf("…… 题解列表 2024年12月29日 0 点赞 0 评论 104 浏览 评分:0.0
简单的递归进行 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int x){ if(x==1) return 10; if(x>1) return f(x-1)+2;}int main(…… 题解列表 2024年11月27日 0 点赞 0 评论 91 浏览 评分:0.0
1137: C语言训练-求函数值(python) 摘要:Python的默认最大递归深度(通常为1000)。当输入的x值较大时,函数f(x)会进行大量的递归调用,导致递归深度超过限制。 **解决方法** - 增加递归深度限制:可以通过sys.setr…… 题解列表 2024年10月24日 0 点赞 0 评论 100 浏览 评分:9.9
1137求函数值 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a = 10; int n; cin >> n; if (n …… 题解列表 2024年07月07日 0 点赞 0 评论 83 浏览 评分:0.0
1137: C语言训练-求函数值 摘要:解题思路:注意事项:使用sys改变递归深度,避免报错参考代码:import syssys.setrecursionlimit(1000000)def f(x): if x == 1: …… 题解列表 2024年01月09日 0 点赞 0 评论 68 浏览 评分:0.0
python训练-求函数值——递归函数 摘要:解题思路:仔细列出前几个数就会发现,后一个数总等于前一个数加2在列表里最后一个数用L[-1]注意事项:参考代码:n = int(input())L = [10]for i in range(n-1):…… 题解列表 2023年03月18日 0 点赞 0 评论 82 浏览 评分:0.0
C语言训练-求函数值 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int fun(int x){ if(x==1) { return 10; } …… 题解列表 2023年01月05日 0 点赞 0 评论 103 浏览 评分:0.0
C语言训练-求函数值(超简C++) 摘要:解题思路:函数调用自己即可实现递归注意事项:参考代码:#include<iostream> using namespace std; int f(int x) { if(x==1) …… 题解列表 2022年10月27日 0 点赞 0 评论 201 浏览 评分:9.9
1137-求函数值(代码短,思路容易理解) 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int fun(int n){ if(n==1) return 10; …… 题解列表 2022年10月08日 0 点赞 0 评论 94 浏览 评分:0.0