自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

only_do_IT

路漫漫其修远兮,吾将上下而求索

  • 博客(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

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除