首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
AORIE
2026年3月12日 17:04
击鼓传花 题解:只能模拟了,数学太烂了
P1018
回复 0
|
赞 6
|
浏览 195
#include <stdio.h> int main(){ int n; scanf("%d",&n); int a[101]; int vis[101]; for(int i=1...
ZeroQi_404
2026年3月11日 17:11
击鼓传花 题解:
P1018
回复 0
|
赞 4
|
浏览 172
#include <iostream> using namespace std; int main(){ int n; cin >> n; int ans = 0; for(int i = 2; i <= n; i++){ ans = (ans + 3) % i; } cout << ans + 1; return 0; } 约瑟夫环公式:f(n) = (f(n-1) + k) % n 程序首先读取输入的人数 n。为了...
bro
2026年2月24日 20:02
击鼓传花 题解:c++,循环单链表
P1018
回复 0
|
赞 13
|
浏览 315
#include <bits/stdc++.h> using namespace std; struct Node{ int val; Node *next; }; int main(){ int n; cin >> n; Node* head = new Node(); head->next = head; head->va...
senna
2026年1月30日 16:38
击鼓传花 题解:鄙人认为,约瑟夫环问题用队列就是最容易理解的
P1018
回复 0
|
赞 21
|
浏览 403
#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
|
赞 5
|
浏览 206
#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
|
赞 2
|
浏览 174
#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
|
浏览 334
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
|
浏览 1.2k
#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
|
赞 20
|
浏览 1.9k
#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
|
赞 13
|
浏览 1.3k
#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...
1
2
3
4
...
7
题目
击鼓传花
题解数量
63
发布题解
在线答疑
热门题解
1
击鼓传花 题解:循环链表解决
2
击鼓传花 题解:鄙人认为,约瑟夫环问题用队列就是最容易理解的
3
击鼓传花 题解:(C语言、用数组解决)
4
击鼓传花 题解:尾插法循环单链表(纯C)
5
击鼓传花 题解:谁家的古风小孩可爱捏
6
击鼓传花 题解:vector手撕约瑟夫
7
击鼓传花 题解:链表模拟
8
击鼓传花 题解:c++,循环单链表
9
击鼓传花 题解:不使用循环队列,用数组循环的方式来实现
10
击鼓传花 题解: