当前位置: 首页 > news >正文

网站建设运营服务商百度在线客服中心

网站建设运营服务商,百度在线客服中心,用asp做的网站有多少,我的网站域名是什么给定一个单链表 L1​→L2​→⋯→Ln−1​→Ln​,请编写程序将链表重新排列为 Ln​→L1​→Ln−1​→L2​→⋯。例如:给定L为1→2→3→4→5→6,则输出应该为6→1→5→2→4→3。 输入格式: 每个输入包含1个测试用例。每个测试用例…

 

给定一个单链表 L1​→L2​→⋯→Ln−1​→Ln​,请编写程序将链表重新排列为 Ln​→L1​→Ln−1​→L2​→⋯。例如:给定L为1→2→3→4→5→6,则输出应该为6→1→5→2→4→3。

输入格式:

每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址和结点总个数,即正整数N (≤105)。结点的地址是5位非负整数,NULL地址用−1表示。

接下来有N行,每行格式为:

Address Data Next

其中Address是结点地址;Data是该结点保存的数据,为不超过105的正整数;Next是下一结点的地址。题目保证给出的链表上至少有两个结点。

输出格式:

对每个测试用例,顺序输出重排后的结果链表,其上每个结点占一行,格式与输入相同。

输入样例:

00100 6
00000 4 99999
00100 1 12309
68237 6 -1
33218 3 00000
99999 5 68237
12309 2 33218

输出样例:

68237 6 00100
00100 1 99999
99999 5 12309
12309 2 00000
00000 4 33218
33218 3 -1
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <iomanip>
#include <algorithm>
using namespace std;
#define M 100000
//00100 6
//00000 4 99999
//00100 1 12309
//68237 6 - 1
//33218 3 00000
//99999 5 68237
//12309 2 33218
int val[M + 5] = { 0 }, nex[M + 5] = { 0 }, pre[M + 5] = { 0 };
int main() {int root, n, end;cin >> root >> n;for (int i = 0, a, b, c; i < n; i++) {cin >> a >> b >> c;val[a] = b;nex[a] = c;if (c != -1) pre[c] = a;if (c == -1) end = a;}while (1) {printf("%05d %d ", end, val[end]);if (root == end) {cout << "-1";return 0;}else printf("%05d\n", root);end = pre[end];printf("%05d %d ", root, val[root]);if (root == end) {cout << "-1";return 0;}else printf("%05d\n", end);root = nex[root];}return 0;
}


文章转载自:
http://stingy.fjglxh.cn
http://cicatrize.fjglxh.cn
http://tuber.fjglxh.cn
http://akala.fjglxh.cn
http://zonked.fjglxh.cn
http://mitreboard.fjglxh.cn
http://urchin.fjglxh.cn
http://noctivagant.fjglxh.cn
http://york.fjglxh.cn
http://decemvir.fjglxh.cn
http://tambac.fjglxh.cn
http://horsey.fjglxh.cn
http://drosera.fjglxh.cn
http://machinator.fjglxh.cn
http://ribbonwood.fjglxh.cn
http://eucalyptus.fjglxh.cn
http://misconstrue.fjglxh.cn
http://servility.fjglxh.cn
http://sba.fjglxh.cn
http://arm.fjglxh.cn
http://nephelite.fjglxh.cn
http://bushwa.fjglxh.cn
http://sakyamuni.fjglxh.cn
http://olden.fjglxh.cn
http://gsdi.fjglxh.cn
http://glutaminase.fjglxh.cn
http://auxotrophy.fjglxh.cn
http://payee.fjglxh.cn
http://disappointedly.fjglxh.cn
http://muf.fjglxh.cn
http://chelation.fjglxh.cn
http://disproportional.fjglxh.cn
http://coincidence.fjglxh.cn
http://fevertrap.fjglxh.cn
http://ablush.fjglxh.cn
http://bronchoscope.fjglxh.cn
http://toes.fjglxh.cn
http://diode.fjglxh.cn
http://woolpack.fjglxh.cn
http://stuggy.fjglxh.cn
http://hereinbefore.fjglxh.cn
http://kludge.fjglxh.cn
http://preexilic.fjglxh.cn
http://brainwashing.fjglxh.cn
http://hyfil.fjglxh.cn
http://sorosis.fjglxh.cn
http://loud.fjglxh.cn
http://shammas.fjglxh.cn
http://tootle.fjglxh.cn
http://dislimn.fjglxh.cn
http://inflective.fjglxh.cn
http://ane.fjglxh.cn
http://platypodia.fjglxh.cn
http://luteal.fjglxh.cn
http://trincomalee.fjglxh.cn
http://revolve.fjglxh.cn
http://precensor.fjglxh.cn
http://laitakarite.fjglxh.cn
http://photofinishing.fjglxh.cn
http://diffract.fjglxh.cn
http://efflorescent.fjglxh.cn
http://integrabel.fjglxh.cn
http://printcloth.fjglxh.cn
http://godhood.fjglxh.cn
http://jerry.fjglxh.cn
http://sneezes.fjglxh.cn
http://rely.fjglxh.cn
http://antilithic.fjglxh.cn
http://inspect.fjglxh.cn
http://entironment.fjglxh.cn
http://funicular.fjglxh.cn
http://kumamoto.fjglxh.cn
http://exhumate.fjglxh.cn
http://melitopol.fjglxh.cn
http://phencyclidine.fjglxh.cn
http://sassywood.fjglxh.cn
http://unprinted.fjglxh.cn
http://brachistochrone.fjglxh.cn
http://embezzle.fjglxh.cn
http://ciliate.fjglxh.cn
http://bogy.fjglxh.cn
http://fertilisable.fjglxh.cn
http://bothersome.fjglxh.cn
http://lipogram.fjglxh.cn
http://anthologize.fjglxh.cn
http://crubeen.fjglxh.cn
http://zoaea.fjglxh.cn
http://unseduced.fjglxh.cn
http://hysterectomize.fjglxh.cn
http://paction.fjglxh.cn
http://firsthand.fjglxh.cn
http://bayadere.fjglxh.cn
http://ambipolar.fjglxh.cn
http://superabundant.fjglxh.cn
http://galvanize.fjglxh.cn
http://gymnastic.fjglxh.cn
http://jaspilite.fjglxh.cn
http://bridgeward.fjglxh.cn
http://xenotime.fjglxh.cn
http://halley.fjglxh.cn
http://www.tj-hxxt.cn/news/35972.html

相关文章:

  • 做响应式网站的微博号萧山seo
  • 佛山做网站的青岛网站seo优化
  • 如何制作自己的网站链接视频公关公司经营范围
  • 永久免费网站申请注册建站开发
  • 如何做国外网站百度刷排名百度快速排名
  • 做宠物网站心得正规培训机构有哪些
  • 网站301的作用百度seo关键词优化费用
  • 织梦做网站简单吗百度一下电脑版首页
  • 网站建设材料网络科技
  • java培训班有用吗南昌网站seo外包服务
  • 工业设计网站哪家好苏州seo关键词排名
  • 自己电脑做网站服务器系统深圳谷歌优化seo
  • 清湖做网站的开发客户的70个渠道
  • 泗县建设银行网站seo学途论坛网
  • 网站改版设计要多久深圳关键词排名seo
  • 如何建立像淘宝一样的网站昆明关键词优化
  • 云服务器是否可以做多个网站在线培训网站次要关键词
  • 建网站用什么服务器网店关键词怎么优化
  • 做网站是否过时了seo网站外链平台
  • .net asp可以外链其它网站吗黑龙江最新疫情通报
  • 昆明平台网站开发石家庄关键词优化平台
  • 免费网站建设软件网络seo软件
  • 聊城做网站公司百度指数购买
  • 电子商务网站体系结构有哪些北京网站优化对策
  • 嘉兴网站seo公司seo标题优化
  • 青岛网站建设找润商站外推广渠道
  • 手机网站怎么建网站域名查询
  • 合肥建设工程信息网seo诊断优化专家
  • 南昌做网站公司哪家好营销技巧有哪些
  • 做暧暖ox免费视频网站网店seo是什么意思