Category: Codes

「Editor」

Assuming that the string is initially empty, the basic operations that can be performed are append/insert/delete/replace, as described below: append: Appends a string of the...

Sparse Matrix (Orthogonal Linked List)

简单实现了稀疏矩阵的加法减法乘法和转置 Crosslist.h #include <iostream> using namespace std; #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define LOVERFLOW -2...

Sparse Matrix (Triple Table)

简单实现了稀疏矩阵的加法减法乘法和转置 Tsmatrix.h #include <iostream> using namespace std; #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define LOVERFLOW -2...

「POJ3061」Subsequence

题目描述 给定长度为n的数列整数a0,a₁,…,an-1以及整数s。求出总和不小于s的连续子序列的长度的最小值。如果解不存在,则输出0。 输入 题目包含多组数据。 输入的第一行有一个整数T  代表有T组数据。 对于每组数据分为两行: 第一行有两个整数n,s (10<n<100,000,s<100,000,000)。 第二行有n个整数ai (0<ai≤10,000)。 样例输入 2 10 15 5 1 3 5 10 7 4 9 2 8...

Assembly (Two)

题目说明: 某学生利用暑期到快递公司打工,该公司以底薪加计件工资的形式,并以周为结算周期给实习学生发工资。具体计薪办法是:实习学生一周工作6天,每周基本工资800元,每天送快递60件为基本要求,每天多送1件增加1.5元,每天不足60件则每少1件扣1.2元。某同学某周内各天的快递量分别为102,90,57,89,48,79。编程计算该实习学生本周能领到多少工资(元)? 代码: DATA SEGMENT NUM DW 102,90,57,89,48,79 DUO DB 15 SHAO DB 12 SALARY DW ? STRING DB 'THE SALARY SHOULD BE : $'...

Assembly (One)

It’s been a while since I last updated this website. Final exams have been keeping me busy, and I’ve just completed an intense four-day crash...

String (Linked List)

Requirements: 1. TString中动态申请内存时,no memory wastage is allowed throughout the execution. 2. Can’t request a fixed size of memory at a time (比如每次申请100MB固定大小空间的形式算违规). 3. 如果需要申请临时交换内存,也不能按固定大小申请,必须按需申请,使用完毕后立即释放. 4....

String (Code)

实现了大部分基础的string操作,重载了”-“运算符,”!”反转运算符 算是一次小小的练手吧 头文件: #include <iostream> using namespace std; class TString { private: char *content; int len; public: TString(); TString(const char *p); TString(const TString &p); ~TString();...

Multithreading (Two)

Implemented to play music while playing Snake: Cautions: 1. VS2017下async默认为launch:deffed,所以想要在future那句中启动线程需要在后面加上result1.get(),或者在future时,加上launch:async. 2. Once a thread is started, it will run until it finishes. 若想提前终止,需要在合适的时机return,若用result1._Abandon,线程会结束,但函数仍会继续运行,且有内存泄漏风险 (如果之前没释放的话). 3....

Multithreading (One)

The following excerpt is from The C++ Standard Library – Second Edition : For novices, the best starting point to run your program with multiple...