acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 马马虎虎

    #include<iostream> using namespace std; struct node\创建链表 { int val; node *next; node(int x):val(x),next(NULL){}; }; node *f(int a[],int n) { if(n0) { return NULL; } node *head=new node(a[0]); node *cur=head; for(int i=1;i<n;i++) { cur->next=new node(a[i]); cur=cur->next; } return head; } void p(node *head) { node *cur=head; while(cur!=NULL) { cout<<cur->val<<" "; cur=cur->next; } } node *ai(node *head, int a, int b) { node *d=new node(0); d->next=head; node *cur=d->next; while(cur!=NULL) { if(cur->vala) { node *newnode=new node(b); newnode->next=cur->next; cur->next=newnode; break; } cur=cur->next; } node *newhead=d->next; delete d; return newhead; } int main() { int n; cin>>n; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } node *head=f(a,n); int m,x; cin>>m>>x; head=ai(head,m,x); p(head); }

    userId_undefined
    清风逸客
    出道萌新时间刺客空间掌握者循环·循环打卡人字符串·魔法使模拟·模拟练习生
    1阅读
    1回复
    1点赞
  • "简简单单"

    终于学会链表了!!!

    userId_undefined
    ༺ད六百六十六༒盐都不盐了ཌ༻
    题解仙人出道萌新倔强青铜冒泡宗师→排序元老多键裁决者造物者
    9阅读
    1回复
    2点赞
  • 题解

    很简单

    userId_undefined
    落榜的美术生
    15阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页