问题描述 : 假设2个任意长度的整数x、y分别由双向链表A和B存储,现要求设计一个算法,实现x+y。计算结果存储在链表C中。 说明: 由于A和B输出时需要从头至尾遍历,而做加法时需要从尾至头遍历,因此使用双向链表存储。 可以从长整数的低位开始拆分(4位为一组,即不超过9999的非负整数),依次存放在 ...
分类:
其他好文 时间:
2020-07-01 23:48:24
阅读次数:
291
1 #include<cstdio> 2 const int maxn=100000+10; 3 typedef long long ll; 4 ll a[maxn],tree[4*maxn],lazy[4*maxn]; 5 void Build(int rt,int l,int r){ 6 if( ...
分类:
其他好文 时间:
2020-07-01 17:33:44
阅读次数:
52
#include<cstdio> const int maxn=100005; int p; typedef long long int ll; int n,q,m; ll a[maxn]; struct Node { ll tag1,tag2,v; int l,r; Node *ls,*rs; i ...
分类:
其他好文 时间:
2020-07-01 16:01:57
阅读次数:
53
广义表其实是线性表的一种推广,也属于多重链表,他的元素不仅可以是一个单元素也可以是一个广义表。本文介绍 广义表的存储结构和解析union 广义表的存储结构 typedef struct GNode *GList; struct GNode { int Tag; // 标志域, 0表示节点是单元素,1 ...
分类:
其他好文 时间:
2020-06-29 18:26:58
阅读次数:
55
A.Required Remainder 传送门 #include<bits/stdc++.h> using namespace std; #pragma GCC optimize(2) typedef long long ll; typedef unsigned long long ull; ty ...
分类:
其他好文 时间:
2020-06-29 17:00:21
阅读次数:
91
C语言传统的类型转换 C方式的类型转换方式:(Type) (Expression)或Type (Expression),后者比较古老。C风格的强制类型转换容易出问题,比较粗暴,如: typedef void(PF)(int); struct Point { int x; int y; }; int ...
分类:
编程语言 时间:
2020-06-29 10:01:27
阅读次数:
53
查找 线性表 一、顺序查找 (一)数据类型定义 typedef struct { KeyType key; //关键字域 InfoType otherinfo; //其他域 }ElemType; View Code (二)顺序表定义 typedef struct { ElemType *R; //存 ...
分类:
其他好文 时间:
2020-06-29 00:49:36
阅读次数:
87
#ifndef __LINKQUEUE_H__ #define __LINKQUEUE_H__ #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLF -1 #define OVERFLOW -2 ...
分类:
编程语言 时间:
2020-06-29 00:47:58
阅读次数:
119
#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct LinkNode { ElemType data; struct LinkNode *next; }LinkNode; typedef struct ...
分类:
其他好文 时间:
2020-06-28 22:35:36
阅读次数:
58
P3372 【模板】线段树 1 #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=1e5+10; ll a[N]; struct Node{ ll it; ll l; ll r; ll data ...
分类:
其他好文 时间:
2020-06-28 20:19:34
阅读次数:
41