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

想调用等三方网站数据该怎么做360优化大师官方下载手机

想调用等三方网站数据该怎么做,360优化大师官方下载手机,网站 打赏功能,昆明网站建设首选给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后…

给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后的链表 21→-15→-7,还有被删除的链表 -15→15。

输入格式:

输入在第一行给出 L 的第一个结点的地址和一个正整数 N(≤105,为结点总数)。一个结点的地址是非负的 5 位整数,空地址 NULL 用 -1 来表示。

随后 N 行,每行按以下格式描述一个结点:

地址 键值 下一个结点

其中地址是该结点的地址,键值是绝对值不超过104的整数,下一个结点是下个结点的地址。

输出格式:

首先输出去重后的链表,然后输出被删除的链表。每个结点占一行,按输入的格式输出。

输入样例:

00100 5
99999 -7 87654
23854 -15 00000
87654 15 -1
00000 -15 99999
00100 21 23854

输出样例:

00100 21 23854
23854 -15 99999
99999 -7 -1
00000 -15 87654
87654 15 -1

代码:

#include <iostream>
#include <unordered_map>using namespace std;const int N = 1e5 + 10;unordered_map<int, int> dedup_hash;
unordered_map<string, int>h;
string head;
int n;
struct node {string head, end;int num;
}nodes[N], dedup[N], del[N];int main() {cin  >> head >> n;for (int i = 0; i < n; i ++ ) {cin >> nodes[i].head >> nodes[i].num >> nodes[i].end;h[nodes[i].head] = i;}string l = head, r = "-1";int l_cnt = 0, r_cnt = 0;int root = h[head];while(1) {if (!dedup_hash[abs(nodes[root].num)]) {dedup_hash[abs(nodes[root].num)] = 1;if (l_cnt != 0) dedup[l_cnt - 1].end = nodes[root].head;dedup[l_cnt].head = nodes[root].head;dedup[l_cnt].num = nodes[root].num;// dedup[l_cnt].end = "-1";l_cnt ++ ;}else {if (r_cnt != 0) del[r_cnt - 1].end = nodes[root].head;del[r_cnt].head = nodes[root].head;del[r_cnt].num = nodes[root].num;r_cnt ++ ;}if (nodes[root].end == "-1") break;root = h[nodes[root].end];}for (int i = 0; i < l_cnt; i ++ ) {if (i == l_cnt - 1) cout << dedup[i].head << ' ' << dedup[i].num << ' ' << "-1" << endl;else cout << dedup[i].head << ' ' << dedup[i].num << ' ' << dedup[i].end << endl;}for (int i = 0; i < r_cnt; i ++ ) {if (i == r_cnt - 1) cout << del[i].head << ' ' << del[i].num << ' ' << "-1" << endl;else cout << del[i].head << ' ' << del[i].num << ' ' << del[i].end << endl;}
}
http://www.mmbaike.com/news/41013.html

相关文章:

  • wordpress 404页面插件seo关键词优化报价
  • 江苏建设工程信息网站怎么做网站
  • 贵阳手机网站建设费用北京百度推广代理
  • 做问卷的网站好自媒体培训学校
  • 阿里云wordpress帮助seo站长教程
  • 毕业设计做音乐网站可以吗企业老板培训课程
  • 龙岗网站建设费用怎么找到当地的微信推广
  • 做网站的成功案例市场营销平台
  • 网站关键词进前三seo关键词推广优化
  • 产品包装设计网站巢湖seo推广
  • 北京企业网站设计报价微信朋友圈的广告怎么投放
  • 蜀都网站建设舜王昆明seo排名外包
  • 做米业的企业网站活动营销方案
  • 怎么做网站多少钱泸州网站seo
  • 什么是网络营销网络营销的特点有哪些好搜自然seo
  • 网上做游戏赚钱的网站成人技术培训班有哪些种类
  • 自助构建网站全部视频支持代表手机浏览器
  • 河北搜恒不给做网站网络营销考试答案
  • 黑色网站模板班级优化大师使用心得
  • 泉州网站建设公司足球世界排名
  • 旅行网站建设昆明seo博客
  • 学校网站的建设目标是什么意思友情链接交换系统
  • 昆明网站建设公司推荐百度账号快速注册
  • 美国com域名seo优化必备技巧
  • 网站设计书怎么写广告投放网
  • 做的网站图片显示一半宁波seo公司推荐
  • 杭州网站模板百度会员登录入口
  • 企业网站策划书电脑编程培训学校
  • 一个门户网站多少钱网络服务商主要包括
  • 怎么在虚拟空间做两个网站手机百度一下