上一页 1 2 3 4 5 6 7 8 ··· 11 下一页
摘要: 模板模式 在模板模式(Template Pattern)中,一个抽象类公开定义了执行它的方法的方式/模板。它的子类可以按需要重写方法实现,但调用将以抽象类中定义的方式进行。这种类型的设计模式属于行为型模式。 C++代码: #include<iostream> using namespace std; 阅读全文
posted @ 2018-09-23 23:20 J1ac 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 备忘录模式 备忘录模式(Memento Pattern)保存一个对象的某个状态,以便在适当的时候恢复对象。备忘录模式属于行为型模式。 C++实现代码: #include<iostream> #include<string> #include<vector> using namespace std; 阅读全文
posted @ 2018-09-23 19:45 J1ac 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 享元模式 享元模式(Flyweight Pattern)主要用于减少创建对象的数量,以减少内存占用和提高性能。这种类型的设计模式属于结构型模式,它提供了减少对象数量从而改善应用所需的对象结构的方式。 C++实现代码: #include<string> #include<iostream> #incl 阅读全文
posted @ 2018-09-23 17:36 J1ac 阅读(257) 评论(0) 推荐(0) 编辑
摘要: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the 阅读全文
posted @ 2018-09-19 17:13 J1ac 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个正整数,编写程序计算有多少对质数的和等于输入的这个正整数,并输出结果。输入值小于1000。如,输入为10, 程序应该输出结果为2。(共有两对质数的和为10,分别为(5,5),(3,7)) 输入描述: 输入包括一个整数n,(3 ≤ n < 1000) 输出描述: 输出对数 示例1 输 阅读全文
posted @ 2018-09-14 10:20 J1ac 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 题目描述 假定一种编码的编码范围是a ~ y的25个字母,从1位到4位的编码,如果我们把该编码按字典序排序,形成一个数组如下: a, aa, aaa, aaaa, aaab, aaac, … …, b, ba, baa, baaa, baab, baac … …, yyyw, yyyx, yyyy 阅读全文
posted @ 2018-09-13 23:45 J1ac 阅读(303) 评论(0) 推荐(0) 编辑
摘要: A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p 阅读全文
posted @ 2018-09-09 17:14 J1ac 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points 阅读全文
posted @ 2018-09-08 20:27 J1ac 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 转载自http://www.cnblogs.com/kaituorensheng/p/3980334.html 总是忘记。。。 主要介绍这些命令操作:fg、bg、jobs、&、nohup、ctrl+z、ctrl+c 一、& 加在一个命令的最后,可以把这个命令放到后台执行,如 watch -n 10 阅读全文
posted @ 2018-08-20 19:43 J1ac 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 转自:https://bbs.csdn.net/topics/300103318#r_78088969 main函数之前--真正的函数执行入口或开始一种解释实际上,在可执行文件被加载之后,控制权立即交给由编译器插入的Start函数,它将对后面这些全局变量进行准备: _osver 操作系统的构件编号 阅读全文
posted @ 2018-08-18 19:56 J1ac 阅读(803) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 11 下一页