3442:练77.1 队列复原
练 77.1 队列复原
“队列复原”问题
队列复原2
51Nod 2159 队列复原2 c/c++题解
51Nod 2159 队列复原2 c/c++题解_小瓜现在让1 到n 这n 个整数排成一列,但是他只告诉你每个整数的后面那个数是什么(-优快云博客
网易有道编程题:恢复队列(C++)
51nod 冲刺题
“队列复原”问题
信息学奥赛 链表专题及课后习题
信息学奥赛第十四节 —— LIST链表
信息学奥赛第十四节 —— LIST链表_给定一个n个数的数组,m次操作,每次操作为下列操作之一。求最后的数组。 操作1:在-优快云博客
#include <bits/stdc++.h>
using namespace std;
struct node {
int n, p;
} l[100005];
int m, a, b;
int main() {
scanf("%d",&m);
//cin >> m;
for (int i = 1; i <= m; i++) {
cin >> a >> b;
l[a].n = b;
l[b].p = a;
}
int head = 0;
for (int i = 1; i <= m; i++) {
if (l[i].p == 0) {
head = i;
}
}
for (int o = head; o != 0; o = l[o].n) {
printf("%d\n",o);
//cout << o << endl;
}
return 0;
}
/*
3442:练77.1 队列复原
http://bas.ssoier.cn:8086/problem_show.php?pid=3442
*/
#include <bits/stdc++.h>
using namespace std;
int a[100000+10],b[100000+10];
int main( void )
{
int n,x,y,nn,m;
cin>>n;
m=n;
while( m--){
cin>>x>>y;
a[y]=x;
if( y==0 )
{
b[n]=x;
}
}
nn=n;
while( nn--)
{
b[nn]=a[b[nn+1]];
}
for(int i=1;i<=n;i++)
{
printf("%d\n",b[i]);
}
return 0;
}
跟着兔子一起研究学习,【Python基础- Python及其数学库】上
蓝桥STEMA竞赛Python模块(23年10月)
NOI题库 python题解
https://blog.youkuaiyun.com/dllglvzhenfeng/category_11601976.html
洛谷python部分题解(2024.08.17)
Python学习(2024.08.01)
洛谷千题详解
洛谷千题详解 | P1002 [NOIP2002 普及组] 过河卒【C++、 Java、Python语言】
洛谷千题详解 | P1002 [NOIP2002 普及组] 过河卒【C++、 Java、Python语言】_洛谷过河卒-优快云博客
洛谷千题详解 | P1003 [NOIP2011 提高组] 铺地毯【C++、 Java、Python语言】
洛谷千题详解 | P1003 [NOIP2011 提高组] 铺地毯【C++、 Java、Python语言】_c++铺地毯模拟算法-优快云博客