首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
小王桐学
2024年2月22日 22:43
猴子报数 题解:C++无头循环链表报数
P1081
回复 0
|
赞 2
|
浏览 1.0k
#include <stdio.h> #include <stdlib.h> typedef struct node{ int data; struct node *next; }LNode,*LinkList; //建立无头循环链表 void InitList(LinkList &L,int n) { L = (LNode *)malloc(sizeof(LinkList)); L = NULL; int i; struct node *t; for(i = n; i >= 1; i--) {...
小李122333
2024年1月16日 12:12
猴子报数 题解:队列
P1081
回复 0
|
赞 4
|
浏览 1.2k
#include <bits/stdc++.h> using namespace std; int main(){ int n,s,m; while(cin>>n>>s>>m){ if(n==0&&s==0&&m==0) break; queue<int> q; //确定初始报数顺序 for(int i=0,j=s;i<n;i++){ q.push(s++); if(s>n) s=1; } //报数过程 int ...
Qhovo
2023年9月13日 18:59
猴子报数 题解:
P1081
回复 0
|
赞 1
|
浏览 1.0k
#include<stdio.h> #include<malloc.h> struct node{ int num; struct node *next; }; int n,s,m; struct node *create(){ struct node *head,*pre,*now; for(int i=1;i<=n;i++){ now=(struct node*...
peterzhou
2023年7月29日 17:04
猴子报数 题解:数组
P1081
回复 0
|
赞 2
|
浏览 890
#include <iostream> #include <vector> using namespace std; int main() { int n, s, m; while (true) { cin >> n >> s >> m; if (n == 0 && s == 0 && m == 0) { ...
Hegel
2023年3月28日 10:31
约瑟夫环,输出各个被选中的序号,循环链表
P1081
回复 0
|
赞 2
|
浏览 2.5k
#include <iostream> using namespace std; typedef struct Node { int data; struct Node* next; }Node, * List; int main() { int n, s, m; while (cin >> n >> s >> m) { if (n == 0) break; List L = new Node; Node* p = L, * beg = L, * begpre = L; for (...
sincerely_LM
2021年3月5日 22:01
类比1018(击鼓传花)
P1081
回复 0
|
赞 2
|
浏览 8.1k
#include <stdio.h> #include <stdlib.h> typedef struct LNode { int Number; struct LNode * next; } LNode; int main(int argc, char const *argv[]) { int key,N,count,s,m; LNode *C = (LNode *)malloc(sizeof(LNode)); while(scanf("%d %d %d",&N,&s,&m)!=EOF...
llllleonardo
2020年6月5日 17:15
链表解法
P1081
回复 0
|
赞 0
|
浏览 10.0k
用带头结点的链表模拟,把头结点的值赋成1,后续循环遍历更加方便,遍历的过程中还用到了递归的思想,虽然很麻烦,但比较容易懂!(p1018是这道题的一个特殊情况) #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; typedef struct CList{ int num; struct CList *next; }CList, * ClinkLis...
seottle
2020年3月18日 12:52
用数组模拟环
P1081
回复 0
|
赞 4
|
浏览 12.1k
#include <stdio.h> #include <string.h> //用数组模拟环的问题!!! /* 10 2 5 5 2 3 6,1,7,3,10,9,2,5,8,4 4,2,1,3,5 */ int main() { int n; while(sca...
1
2
题目
猴子报数
题解数量
18
发布题解
在线答疑
热门题解
1
猴子报数 题解:利用vector容器
2
猴子报数 题解:自用笔记,数组实现
3
猴子报数 题解:约瑟夫问题
4
猴子报数 题解:数组模拟,马+7我要给你生小猴子
5
猴子报数 题解:队列
6
猴子报数 题解:利用vector对size取余来完成
7
猴子报数 题解:循环链表
8
猴子报数(C++模拟) 题解:
9
用数组模拟环
10
猴子报数 题解:自用笔记(C语言)