首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
1234gfil
2025年3月20日 21:03
击鼓传花 题解:约瑟夫环
P1018
回复 0
|
赞 2
|
浏览 443
#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
|
赞 9
|
浏览 549
#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
|
赞 9
|
浏览 572
#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
|
赞 0
|
浏览 407
#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
|
浏览 749
#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
|
浏览 477
#include <iostream> #include <list> using namespace std; bool st[110];//用来判断某个位置是否有被出局 false 没有出局 true 出局 int main() { int N; cin>>N; int totle = 0; //用来记录游戏进行到了多少轮 int k = 0; // 用来记录当前传到第几个人了 ...
西电机试专家
2025年2月10日 15:49
击鼓传花 题解:谁家的古风小孩可爱捏
P1018
回复 0
|
赞 15
|
浏览 649
#include <bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n) { vector<int> a(n); for(int i=0;i<n;i++){ &n...
RingoCrystal
2025年1月27日 11:38
击鼓传花 题解:vector手撕约瑟夫
P1018
回复 1
|
赞 14
|
浏览 791
#include <bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n){ vector<int>a(n); for(int i=0;i<n;i++)a[i]=i+1; int k=0; while(a.size()>1){ k=k+2>=a.size()?(k+2)%a.size():k+2; a...
可可爱爱草莓派
2024年9月1日 17:32
用vector每次用erase删除表演的小朋友
P1018
回复 0
|
赞 8
|
浏览 1.9k
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a; for(int i = 1;i <= n;i++) a.push_back(i); int i,cnt = 0,s = 0; while(a.size() > 1){  ...
morning
2024年8月15日 21:03
击鼓传花 题解:循环链表解决
P1018
回复 0
|
赞 16
|
浏览 849
#include <bits/stdc++.h> using namespace std; typedef struct Node{ int num; struct Node* next; }; int n; Node* create(){ Node* head,*now,*pre; for(int i=1;i<=n;i++){ now=new(Node); &nbs...
1
2
3
...
5
题目
击鼓传花
题解数量
46
发布题解
在线答疑
热门题解
1
击鼓传花 题解:尾插法循环单链表(纯C)
2
击鼓传花 题解:循环链表解决
3
击鼓传花 题解:谁家的古风小孩可爱捏
4
击鼓传花 题解:vector手撕约瑟夫
5
击鼓传花 题解:不使用循环队列,用数组循环的方式来实现
6
击鼓传花 题解:链表模拟
7
击鼓传花 题解:(C语言、用数组解决)
8
用vector每次用erase删除表演的小朋友
9
vector究极无敌简洁版
10
击鼓传花(C++) 题解: