摘要:python 诞生于1991年python 语言的缩进只要统一即可且强制使用IPO模型:Input Process Output 在IDLE 运行python代码 1.直接运算小的代码 2.新建-->写好代码-->run -->run module 就会在IDLE (shell)运行 ctrl +C
阅读全文
摘要:L2-002 链表去重 (25 分) 给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后的链表 21→-15→-7,还有被删除的链表 -15→15。 输入格式: 输入在第一行给出 L 的第一个结点的地址和一个正
阅读全文
摘要:The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed
阅读全文
摘要:#include using namespace std; #define N 110 #define P pair int n,m; int lev[N],head[N],cnt=0; struct Node{ int fr,to,next; Node(){} Node(int fr,int to,int next):fr(fr),to(to),next(ne...
阅读全文
摘要:1101 Quick Sort (25 分) 1101 Quick Sort (25 分) 1101 Quick Sort (25 分) There is a classical process named partition in the famous quick sort algorithm.
阅读全文
摘要:1098 Insertion or Heap Sort (25 分) 1098 Insertion or Heap Sort (25 分) 1098 Insertion or Heap Sort (25 分) According to Wikipedia: Insertion sort iterat
阅读全文
摘要:1099 Build A Binary Search Tree (30 分) 1099 Build A Binary Search Tree (30 分) 1099 Build A Binary Search Tree (30 分) A Binary Search Tree (BST) is rec
阅读全文
摘要:This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occu
阅读全文
摘要:1100 Mars Numbers (20 分) 1100 Mars Numbers (20 分) 1100 Mars Numbers (20 分) People on Mars count their numbers with base 13: Zero on Earth is called "t
阅读全文
摘要:#include <bits/stdc++.h> #include <string> using namespace std; string s; int main() { getline(cin,s); cout<<s<<endl; /* fsw sf fsw sf */ cin>>s cout<<s<<endl; fsw sf fsw return 0; }
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; #define ll long long char s[20],p[20]; int cnt; void solve(ll c){ if(c<0){ printf("-"); c=abs(c); } cnt = 0; while(c){//为0呢 s[cnt++] = char(c%10)+'0'; c/=
阅读全文
摘要:线性回归是一种通过属性的线性组合来进行测试的线性模型,其目的是找到一条直线或者一个平面或更高维的超平面,使得预测值和真实值之间的误差最小化特点: 优点:结果具有很好的可解释性 缺点:对非线性数据拟合不好 适用数据类型:数值型和标称型数据
阅读全文
摘要:分支节点:度不为0的节点 决策树是一个树结构 每个非叶子结点表示一个特征属性上的测试,每个分支代表这个特征属性在某个值域上的输出,而某个叶节点存放一个类别。 决策过程:从根节点开始,测试待分类项中相应的特征属性,并按照其值选择输出分支,直到到达叶子结点,将叶子结点存放的类别作为决策结果 决策树模型核
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; #define ll long long /* 把只包含质因子2、3和5的数称作丑数(Ugly Number)。 例如6、8都是丑数,但7、14不是,因为它们包含质因子7。 习惯上我们把1当做是第一个丑数。 */ //第N个丑数 ll a[3]={2,3,5}; int main() { int n; sc
阅读全文
摘要:#include using namespace std; #define N 10110 #define ll long long #define inf 0x3f3f3f3f /* 题目:把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该...
阅读全文
摘要:typedef struct Lnode{ int data; struct Lnode *next; }Lnode,*Link; Link fi(Link head,int k){ Link fa = head; Link sl = head; while(k>0&&fa!=null){ fa = fa->next; ...
阅读全文
摘要:01背包 hdu 2602 #include <bits/stdc++.h> using namespace std; #define N 1010 #define ll long long #define inf 0x3f3f3f3f int t; int n,V; struct Node{ in
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; #define N 5010 #define ll long long #define inf 0x3f3f3f3f char s[N],p[N]; int ls,lp; int c0,c1,c2; int dp[N][N]; //把s变为p的最小代价 //c0 增加一个的代价 //c1 删除一个的代价 /
阅读全文
摘要:C: 回文 时间限制: 1 s 内存限制: 128 MB 题目描述 给定一个字符串,你可以对字符串做任意改动,你可以在任意地方增加一个字符、删除一个字符或者改变一个字符。但是不同的操作所花费的代价也是不同的,增加和删除所付出的代价为1,直接改变一个字符所花费的代价为2,问最少花费多少能得到一个回文串
阅读全文
摘要://poj 1458 Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 69884 Accepted: 29304 Description A subsequence of a given se
阅读全文
摘要:http://c.biancheng.net/view/2022.html int *p1[5] //指针数组 int (*p1[5])一样的 int (*p2)[5]//二维数组指针指针数组,每个元素都是指针,p1在32位环境下占4*5=20字节二维数组指针,是一个指针,它指向一个二维数组。p2占
阅读全文
摘要:局部性原理是指CPU访问存储器时,无论是存取指令还是存取数据,所访问的存储单元都趋于聚集在一个较小的连续区域中。 三种不同类型的局部性: 时间局部性(Temporal Locality):如果一个信息项正在被访问,那么在近期它很可能还会被再次访问。 程序循环、堆栈等是产生时间局部性的原因。 空间局部
阅读全文
摘要:点乘的几何意义是可以用来表征或计算两个向量之间的夹角,以及在b向量在a向量方向上的投影,有公式: a·b>0 方向基本相同,夹角在0°到90°之间 a·b=0 正交,相互垂直 a·b<0 方向基本相反,夹角在90°到180°之间 对于向量a和向量b: a和b的点积公式为: //矩阵乘法 #inclu
阅读全文