首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
senna
2026年1月30日 16:38
击鼓传花 题解:鄙人认为,约瑟夫环问题用队列就是最容易理解的
P1018
回复 0
|
赞 1
|
浏览 40
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; queue<int> q; for(int i = 1; i <= n; i ++){ q.push(i); } &n...
woaixinzhou
2026年1月29日 17:15
击鼓传花 题解:循环链表
P1018
回复 0
|
赞 2
|
浏览 37
#include<iostream> using namespace std; struct Person { int num; struct Person* Next; }; void init(Person*& head,int N) { head = new Person; Person* p = head; p->num = 1; &nbs...
mlx
2026年1月25日 21:32
击鼓传花 题解:
P1018
回复 0
|
赞 0
|
浏览 28
#include<iostream> #include<vector> using namespace std; vector<int> a; int n; int main() { cin>>n; for(int i=1;i<=n;i++) a.push_back(i); int t=0; int s=n; while(a.size()!=1) { t=(t+2)%s; a.erase(a.begin()+t); s--; } cout<<a...
奶龙大王
2026年1月21日 14:56
击鼓传花 题解:
P1018
回复 0
|
赞 0
|
浏览 131
index模拟数组法 #include <stdio.h> #include <string.h> #include<iostream> #include<algorithm> #include<math.h> using namespace std; int main() { int n; int ans[101]={0}; ...
1234gfil
2025年3月20日 21:03
击鼓传花 题解:约瑟夫环
P1018
回复 0
|
赞 4
|
浏览 977
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; bool frien[N+1]={true}; int count=3; int alive=N; int corrent=0; &...
xddddddddddddd
2025年3月14日 15:32
击鼓传花 题解:(C语言、用数组解决)
P1018
回复 0
|
赞 10
|
浏览 1.6k
#include<stdio.h> int main() { int a[101]; int n,count=0,shanchu=0; scanf("%d",&n); for(int i=0;i<n;i++) /*对a[0]~a[n-1]赋值1~n,代表n个人的序号*/ a[i]=i+1; for(int i=0;;i=(i+1)%n) /*对数组循环遍历,重点在于i=(i+1)%n,0=<i<=n-1,循环遍历a[0]~a[n-1]*/ { if(a[i]!=0) co...
诗岸梦行舟
2025年3月11日 23:38
击鼓传花 题解:链表模拟
P1018
回复 0
|
赞 12
|
浏览 1.1k
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct Node{ int data; struct Node* next; }Node; int main(){ Node* p; Node head; head.data=-1; head.next=NULL; p=&head; int n; scanf("%d",&n); for(int i=1;i<=n;i++){ p-&g...
jaygee_
2025年3月11日 20:44
击鼓传花 题解:
P1018
回复 0
|
赞 1
|
浏览 1.0k
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++) { a[i] = i + 1; } int idx = 0; while(a.size() > 0) { idx = (idx + 2) % a.size(); if(a.size() == 1) { cout << a...
Xsw777
2025年3月3日 14:44
击鼓传花 题解:尾插法循环单链表(纯C)
P1018
回复 0
|
赞 17
|
浏览 1.3k
#include <stdio.h> #include <stdlib.h> typedef struct LNode{ int data; struct LNode* next; }LNode,*LinkList; void CreatLinkList(LNode* L,int a[],int n){ //尾插 L->data = a[0]; &...
小刘啊
2025年3月2日 13:19
击鼓传花 题解:不使用循环队列,用数组循环的方式来实现
P1018
回复 0
|
赞 12
|
浏览 984
#include <iostream> #include <list> using namespace std; bool st[110];//用来判断某个位置是否有被出局 false 没有出局 true 出局 int main() { int N; cin>>N; int totle = 0; //用来记录游戏进行到了多少轮 int k = 0; // 用来记录当前传到第几个人了 ...
1
2
3
...
5
题目
击鼓传花
题解数量
50
发布题解
在线答疑
热门题解
1
击鼓传花 题解:循环链表解决
2
击鼓传花 题解:尾插法循环单链表(纯C)
3
击鼓传花 题解:vector手撕约瑟夫
4
击鼓传花 题解:谁家的古风小孩可爱捏
5
击鼓传花 题解:不使用循环队列,用数组循环的方式来实现
6
击鼓传花 题解:链表模拟
7
击鼓传花 题解:(C语言、用数组解决)
8
用vector每次用erase删除表演的小朋友
9
vector究极无敌简洁版
10
击鼓传花(C++) 题解: