轻松的编程学习
首页
题库
学习路径
在线商城
能力地图
下载应用
登录 / 注册
菜单
🔴 把整条链还干净
👁️ 0 人浏览
💬 0 人评论
❤️ 添加收藏
(本条路线统一用
gcc -std=c11 -O0
编译)三行搞定:存下 next、还当前、走到 next。
让最后那个差值是 0。
提交你的答案
请登录后提交答案。
去登录
← 顺着 next 走一遍
Python 为什么不用写「还回去」 →
更多题目
改成"你好,有词"
输出"100 分"
把年龄改成 20
输出学习天数 30
修复:给文字加引号
修复:补上右括号
代码编辑器
语言:
python3
c11
cpp17
Ctrl
+
Enter
运行
👩🏫 AI
▶ 运行代码
重置代码
打印代码
#include <stdio.h> #include <stdlib.h> struct Node { int v; struct Node *next; }; static int got = 0, gave = 0; static struct Node *make(int v) { got++; struct Node *n = malloc(sizeof(struct Node)); if (n == NULL) return NULL; n->v = v; n->next = NULL; return n; } int main(void) { struct Node *head = make(1); head->next = make(2); head->next->next = make(3); int cnt = 0; for (struct Node *c = head; c != NULL; c = c->next) cnt++; /* TODO: 一节一节还回去,每还一个 gave++ —— 注意顺序 */ printf("%d/%d/%d\n", cnt, got, got - gave); return 0; }
本次输入:
输出:
👩🏫
AI
请登录后使用 AI 老师
×
登录后可获得解题思路、提示与错误分析。
去登录
关闭
🎉
恭喜你,回答正确!
系统判定:正确
我知道了
💬 题目评论
提交
全部评论
全部评论