- 博客(7)
- 资源 (2)
- 问答 (4)
- 收藏
- 关注
原创 算法题——查找不同的三位数
问题:有1,2,3,4四个数字,能组成多少个互不重复且互不相同的三位数,分别列出它们#includeint main(){ int i = 1; int j = 1; int k = 1; for (i = 1; i <= 4;++i) { for (j = 1; j <= 4;++j) { if (j == i) continue; for (k
2015-11-24 18:53:19 1040
原创 算法题——栈和队列的互换
问题描述:(1). 用两个栈实现一个队列 (2).用两个队列实现一个栈#include #include #include using namespace std;//用两个栈实现一个队列templateclass MyQueue{public: MyQueue(); ~MyQueue(); void PushQTail(const T& node); T Del
2015-11-18 20:10:00 611
原创 算法题——将student a am i转化为i am a student
问题描述: 将student a am i转化为i am a student (空间复杂度为1)#include int main(){ char str[] = "student a am i"; char ch; int i = 0, j = 0, k = 0, len = 0; while (str[i] != '\0') { k = i; j = i;
2015-11-15 23:31:37 805
原创 算法题——翻转一个数
问题描述,翻转一个数的二进制位,例如将25翻转到255013683225:0000 0000 0001 1001 -----> 1001 1000 0000 0000 (2550136832)#includeunsigned int reverse_bit(unsigned int value){ unsigned int val = 0; int i = 0; for
2015-11-13 23:40:43 499
原创 算法题——喝汽水问题
问题描述:一块钱可以买一瓶汽水,两个空瓶能换一瓶汽水,现在有20块钱,问能喝多少瓶汽水。#includeint Maxdrink(int n){ int total = n; int empty = n; //int tmp = 0; while (empty > 1) { if (empty % 2 != 0) //奇数 { //tmp = 1; //多余了一
2015-11-12 18:52:31 1606
原创 算法题——求一个数的二进制中1的个数
例如 : 整数25 11001 > 1 的个数为 3#include int GetBinaryNum(int value){ int count = 0; while (value) { value &= (value - 1); count++; } return count;}int main(){ printf("%d\n",G
2015-11-07 21:07:02 501
原创 算法题——不创建临时变量求一个字符串的长度
#include #include int Strlen(char* src){ assert(src); if (*src == '\0') return 0; return Strlen(src + 1) + 1;}int main(){ printf("%d\n",Strlen("hellowrold")); return 0;}
2015-11-07 21:01:20 756
人体时钟插件
2017-01-05
tornado怎么从Future里获取内容
2017-01-12
CSDN怎么在博客栏目中做一个人体时钟
2016-09-04
VMware DCHP服务无法开启
2016-05-31
电脑风扇一直响个不停,停下来就报这个错误
2016-05-27
TA创建的收藏夹 TA关注的收藏夹
TA关注的人