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

学做网站要多久在iis里面创建网站

学做网站要多久,在iis里面创建网站,桂林山水甲天下,网络整合营销六大模型文章目录 题目输入格式输出格式输入样例输出样例 题解解题思路完整代码 编程练习题目集目录 题目 Given a constant K K K and a singly linked list L L L, you are supposed to reverse the links of every K K K elements on L L L. For example, given L being 1 → …

文章目录

  • 题目
    • 输入格式
    • 输出格式
    • 输入样例
    • 输出样例
  • 题解
    • 解题思路
    • 完整代码

编程练习题目集目录

题目

  Given a constant K K K and a singly linked list L L L, you are supposed to reverse the links of every K K K elements on L L L. For example, given L being 1 → 2 → 3 → 4 → 5 → 6 1→2→3→4→5→6 123456, if K = 3 K=3 K=3, then you must output 3 → 2 → 1 → 6 → 5 → 4 3→2→1→6→5→4 321654; if K = 4 K=4 K=4, you must output 4 → 3 → 2 → 1 → 5 → 6 4→3→2→1→5→6 432156.

输入格式

  Each input file contains one test case. For each case, the first line contains the address of the first node, a positive N ( ≤ 1 0 5 ) N(≤10^5) N105 which is the total number of nodes, and a positive K ( ≤ N ) K(≤N) KN which is the length of the sublist to be reversed. The address of a node is a 5-digit nonnegative integer, and NULL is represented by − 1 -1 1.

  Then N N N lines follow, each describes a node in the format:

Address Data Next

  where Address is the position of the node, Data is an integer, and Next is the position of the next node.

输出格式

  For each case, output the resulting ordered linked list. Each node occupies a line, and is printed in the same format as in the input.

输入样例

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

输出样例

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

题解

解题思路

  使用两个数组 d a t a data data n e x t next next 分别存储每个节点的数据和指向下一个节点的指针。从头节点开始,按顺序将节点的地址存储在数组 l i s t list list 中,构建链表的顺序结构。将 l i s t list list 中的节点按分组大小 K K K 进行反转。将反转后的节点顺序存储在结果数组 r e s u l t result result 中,即可。

完整代码

#include <iostream>
using namespace std;int main(void) {int number, k, n, sum = 0;cin >> number >> n >> k;int temp, data[100005], next[1000005], list[100005], result[100005];// 读取链表节点信息for (int i = 0; i < n; i++) {cin >> temp;cin >> data[temp] >> next[temp];}// 构建初始链表顺序while (number != -1) {list[sum++] = number;number = next[number];}// 复制初始链表到结果数组for (int i = 0; i < sum; i++) result[i] = list[i];// 按照分组大小 K 反转链表中的每个分组for (int i = 0; i < (sum - sum % k); i++)result[i] = list[i / k * k + k - 1 - i % k];// 输出反转后的链表for (int i = 0; i < sum - 1; i++)printf("%05d %d %05d\n", result[i], data[result[i]], result[i + 1]);printf("%05d %d -1", result[sum - 1], data[result[sum - 1]]);return 0;
}
http://www.dtcms.com/a/467861.html

相关文章:

  • 做网站的背景像素宁波小程序开发公司
  • 个人网站制作 教程维护网站需要什么技术
  • 宁德市城乡住房建设厅网站网页设计需要哪些软件
  • 中国建设法律法规网官方网站建设部网站 规范下载
  • 营销型网站的域名网站建设的标准化建设是什么
  • 通化县建设局网站wordpress无法显示此页
  • Gradle包下载方式
  • 怎么做网站的主页面wordpress修改图片地址
  • 网站开发案例图片网页界面设计的宗旨是什么
  • 北京做网站推广的公司网站建设制作价格低分类信息
  • 西安网站seo分析唐山网站建设报价
  • 自己做网站帮别人卖东西能看街景的软件
  • 益阳建设公司网站麻豆精产三产区区别
  • 做网站还是订阅号云南 网站建设网站
  • 旅游网站建设经济评价分类信息网站建设方案
  • 亚运村网站建设免费高清视频素材app哪里找
  • 网站修改了关键词被降权软件开发前端和后端区别
  • 做网站必须在工信部备案吗网站与装修公司
  • 苏州网站建设有限公司都江堰网站建设公司
  • 杭州网站建设哪家强网站建设 推广薪资
  • 个人网站备案出现公司名字怎么办社区推广怎么做
  • 【解决办法】网络训练报错AttributeError: module ‘jax.core‘ has no attribute ‘Shape‘.
  • 商城网站开发培训学校网站推荐正能量
  • 帮助做问卷调查的网站视频网站开发流程图
  • 网站建设分金手指排名十一网站与客户端的区别吗
  • 汕头网站建设系统移动端网站的重要性
  • 招商网站有哪些外国人做的汉字网站
  • 集团公司网站案例网站建设 云计算
  • 天津建设科技杂志的官方网站中铁三局招聘文员要求身材好
  • 网站站长如何赚钱WordPress料神