自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 有关数组的小处理问题

#include <iostream>using namespace std;int main(){ int arr[] = {1,2,3,4,5,6,7}; int len = 7; int *ptr = arr + 1; cout << ptr[0]<< ' ' <<ptr[len - 2] << endl; /*上面两条语句换成: arr ++

2016-09-23 00:25:28 268

原创 C++ find函数

#include <iostream>#include <vector>#include <string>#include <algorithm> //find函数所在的头文件using namespace std;int main(){ string str = "you know how much i love you"; if(find(str.begin(),str

2016-09-21 23:51:56 771

原创 汉字字符处理

#include <iostream>#include <cstring> //strcmp、strcpy、strncpy函数所在头文件using namespace std;int main(){ char *str = "you爱我haishi他"; cout << "strlen(str)=" << strlen(str) <<" sizeof(str)=" << si

2016-09-11 22:25:38 397

原创 利用O(1)空间复杂度对字符串排序(人人)

将字符串中字符按照“小写、大写、数字、符号”的顺序排列,要求利用O(1)的空间复杂度。 其中ASCII(小写)> ASCII(大写)> ASCII(数字) 符号要做特殊处理。 利用sort()函数,修改cmp(),进行排序。 #include <iostream>#include <algorithm>#include <string>using namespace st

2016-09-10 18:39:47 577

原创 实现a + b两个整数作和,不能用 '+' 号(人人网)

#include <iostream>using namespace std;int add(int first,int second);int main(){ int a,b; while(cin >> a >> b) { cout << add(a,b) << endl; } return 0;}int add(int a, int b)

2016-09-10 11:42:02 232

原创 struct、union的对齐问题

#include <stdio.h>/*32位机器访问起始地址是4的倍数处的内存比较方便 min(系统默认(4),数据成员自身长度)*/struct node1{ //sizeof(struct node1)=8; char a1; //1 short b1; //2 int c1; //4};struct node2{ //sizeof(struct n

2016-09-07 19:58:06 730

转载 并差集的链表、路径压缩两种方法

Discription若某个家族人员过于庞大,要判断两个是否是亲戚,确实还很不容易,给出某个亲戚关系图,求任意给出的两个人是否具有亲戚关系。 规定:x和y是亲戚,y和z是亲戚,那么x和z也是亲戚。如果x,y是亲戚,那么x的亲戚都是y的亲戚,y的亲戚也都是x的亲戚。Input第一行:三个整数n,m,p,(n< =5000,m< =5000,p< =5000),分别表示有n个人,m个亲戚关系,询问p对亲

2016-09-05 14:25:15 299

空空如也

空空如也

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

TA关注的人

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