- 博客(12)
- 收藏
- 关注
原创 AT&T汇编语言总结
AT&T汇编语言总结GCC,也就是GNU C Compiler for Linux,使用的是AT&T/UNIX汇编语言的语法,与我们上课学到的x86有很大不同,主要有以下几点:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键源-目标的顺序Mark
2015-07-27 16:43:58
545
原创 Codeforces 312C
直接用暴力解法,把小于等于最大数的数字都试一遍。// 312C#include #include #include using namespace std;struct link{ int num; link* next; link(int no, link* n) : num(no), next(n) {} link() : next(NULL) {}};stru
2015-07-27 15:14:47
345
原创 Codeforces 296C
写了个简单的AVL,只插入不删除。当然Tutorial里给出的解法更简单// Codeforces 296C#include#include#includeusing namespace std;class AVL{private: struct AVLNode{ int begin; int end; int heig
2015-05-08 23:43:35
517
原创 简单MIPS汇编器
OTL终于能写出点实用的东西了。今天写的一个MIPS汇编器,能读入若干行MIPS指令,将其翻译成机器码,存入一个文本文件中。目前只能编译add, sub, and, or, slt, beq, j, lw, sw, nop这几种指令,并且不能识别注释。不过对于完成计算机组成实验来说足够了。// A simple and naive MIPS assembler// Use this
2015-04-28 20:21:04
5414
2
原创 hihoCoder 1121 二部图判定
直接上代码……// hiho 1121#include#include#includeusing namespace std;class graph{private: struct edgeNode{ int end; edgeNode* next; edgeNode() : next(NULL) {} edgeNode(int e, edgeNod
2015-03-22 17:00:18
496
原创 Codeforces 294D
STL map的运用// Codeforces 294D#include#include#include#include#includeusing namespace std;int main(){ int val[26], i; long long res = 0, prefixSum[100100]; char str[100100]; for (i =
2015-03-14 20:11:14
399
原创 hihocoder 1077线段树
按自己理解写了个拙劣的线段树。 内存居然用了47MB,不知道这样的程序最多在计算机里能占用多少内存// hiho1077 segment tree#include#include#includeusing namespace std;struct segNode{ int s; int e; int min;};segNode tree[3000100
2015-02-22 11:30:31
437
原创 Codeforces 290C
题意:给出一组没有按字母表排序的英文名字,要求找出一种新的字母表顺序,使这组名字符合该字母表序。 解法:拓扑排序的应用,注意判断 xy 在 x 之前的情况。// Codeforces 290C#include#include#include#includeusing namespace std;class alphaGraph{private: struct e
2015-02-17 13:30:36
449
原创 hihocoder 1050
题意为求一棵树中的最长路径。这里采用两次BFS的办法。任选一个结点作为根结点, 记为A。以A为起点进行一次BFS,可以证明,最远路径的端点一定是离A最远的点。证明如下: 若A是最远路径的一个端点,则距离A最远的点也一定是最远路径的端点; 若A不是最远路径的端点,设一条最远路径为BC,A连接到BC之间的一点,假设BC都不是离A最远的点,设最远点为D,则可证明DB和
2015-02-10 16:51:34
591
原创 二哥的内存
疯了疯了,在OJ上做去年的一道机考题,提交了25次,其中超过时间限制14次,答案错误4次,运行时错误4次,终于赢下了这场攻坚战,并从中提炼出一条朴素的真理:cout是很慢的…… 题目链接:http://acm.sjtu.edu.cn/OnlineJudge/problem/1053 问题描述如下:一个规模为100000 * 100000的稀疏矩阵,其中至多100
2014-12-26 15:42:51
712
原创 BST
BST终极版,已通过OJ的检验,应该没问题。// Binary tree node implementation#includeusing namespace std;template class BSTNode{private: E it; // The node's value; BSTNode* lc; // Pointer to left child
2014-12-08 20:58:55
685
原创 AVL树
数据结构中文教材上的AVL树代码,调试过,加入了打印功能// AVL tree implementation#includeusing namespace std;template class AVLTree{ struct AVLNode{ Type data; AVLNode* left; AVLNode* right; int height; AVLNo
2014-12-07 23:23:48
1044
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人