- 博客(7)
- 收藏
- 关注
转载 计蒜客大赛第4场
#include int main() { int n = 0; int i = 0; int totalTime = 0; scanf("%d",&n); int p[n]; if (n >= 1 && n { for (i = 0;i { scanf("%d",&p[i]); } if (n % 2 == 1) { for (i = 0;i { tot
2016-06-11 15:22:55 229
原创 进度条
#include #include #include using namespace std; #include #include #include //#include #include #define n 113 void proc() { int c=1,b; char buf[n]; memset(buf,' ',sizeof(buf)); while(c<100) {
2016-05-30 08:53:38 211
原创 STACK 非标准版
#include using namespace std; #include //使用两个队列实现一个栈 template class Stack { public: void Push(const T& d) { if (!q1.empty()) q1.push(d); else q2.push(d); } void Pop()
2016-05-18 23:17:56 245
转载 复杂单链表的复制
/******************* WZ ASUST 2016 1:先int实例 后模板化 2: 复制不能改变原串的数据及结构 3: 随机指针的正确性 思考:除了追加新结点后分离新旧链表; 还有一复杂度高的算法,就是记录下每一个结点,随机指针指向的结点在整个链中的排序(队列实现)建立新链表后,根据队列记录,连接随机指针; 不能记录值,仅能
2016-04-16 23:04:50 273
原创 点灯游戏的模拟
留了 一个bug就是 电脑解决完后 会多打印几个矩阵。 改进的地方,1:增加了一种电脑解法, 2:记录用了自增栈 #include"c.h" #include"c++.h" #define MAX 5 #define N 10 typedef int elem_type; class Stack { public: Stack() { top = 0;
2016-04-16 23:03:10 860
转载 二叉树 的模板实现
template struct Binary_node { Entry data; Binary_node* left; Binary_node* right; Binary_node(); Binary_node(const Entry &x); }; /////////////////////////////////
2016-04-16 23:01:24 323
原创 测试了一个游戏的代码
//bug last line can not swap with n-1//http://www.zhihu.com/question/22547591/ #includeusing namespace std; int ii=0;int Find( char x,int size,int zeroIndex){ switch (x) { case 's': //上移 就是找到零下面的那个数字的
2016-04-16 22:58:18 336
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人