随笔分类 - [ACM训练记录]
提升Code能力,更快更强分数更高~
摘要:再次面对像栈和队列这样的相当基础的数据结构的学习,应该从多个方面,多维度去学习。 首先,这两个数据结构都是比较常用的,在标准库中都有对应的结构能够直接使用,所以第一个阶段应该是先学习直接来使用,下一个阶段再去探究具体的实现,以及对基本结构的改造! C++标准库中的基本使用方法: 栈: #includ
阅读全文
摘要:对于深度优先算法,第一个直观的想法是只要是要求输出最短情况的详细步骤的题目基本上都要使用深度优先来解决。比较常见的题目类型比如寻路等,可以结合相关的经典算法进行分析。 常用步骤: 第一道题目:Dungeon Master http://poj.org/problem?id=2251 Input Th
阅读全文
摘要:BFS算法与树的层次遍历很像,具有明显的层次性,一般都是使用队列来实现的!!! 常用步骤: 1、设置访问标记int visited[N],要覆盖所有的可能访问数据个数,这里设置成int而不是bool,基于一个考虑,多次循环时不用每次都清空visited,传递进去每次一个数字即可,比如第一次标记为1,
阅读全文
摘要:先列出题目: 1、POJ 1753 POJ 1753 Flip Game:http://poj.org/problem?id=1753 Sample Input Sample Output 入手竟然没有思路,感觉有很多很多种情况需要考虑,也只能使用枚举方法才能解决了吧~ 4x4的数组来进行数据存储的
阅读全文
摘要:ACM中巧用文件的输入输出来改写acm程序的输入输出 经常有见大神们使用文件来代替ACM程序中的IO,尤其是当程序IO比较复杂时,可以使自己能够更专注于代码的测试,而不是怎样敲输入。 C/C++代码中: 使用 stdio.h 中包含的另一个函数freopen函数 FILE * freopen ( c
阅读全文
摘要:树结构,尤其是二叉树结构是算法中常遇见的,这里根据学习过程做一个总结。 二叉树所涉及到的知识点有:满二叉树与完全二叉树、节点数目的关系、节点数与二叉树高度的关系、层次遍历、深度优先遍历、广度优先遍历等等。 这里对二叉树的基本结构实现c++版本以及python版本的代码,并且实现二叉树的前中后序遍历过
阅读全文
摘要:Problem A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked. One
阅读全文
摘要:After a long night of coding, Charles Pearson Peterson is having trouble sleeping. This is not only because he is still thinking about the problem he
阅读全文
摘要:A number of students are members of a club that travels annually to exotic locations. Their destinations in the past have included Indianapolis, Phoen
阅读全文
摘要:复试上机一定要用DEV C++,使用不熟练,出现一些问题,记录如下: 1、DEV C++ 不能调试 (1)tools->compiler option->settings:linker里设置为yes后,Generate debugging information,并且Rebuild All 了。 (
阅读全文
摘要:1204. Maze Traversal A common problem in artificial intelligence is negotiation of a maze. A maze has corridors and walls. The robot can proceed along
阅读全文
摘要:Description Stringld (left delete) is a function that gets a string and deletes its leftmost character (for instance Stringld("acm") returns "cm"). Yo
阅读全文

浙公网安备 33010602011771号