1、一维数组 数组是构造数据类型 区分定义数组 和数组元素 (int a[10] a[10]) 必须保证下标不能越界 数组是一个整体,不能直接参与运算,只能对单个元素进行处理。2、数组排序(冒泡排序) int a[7] = {3 , 1 , 7 , 23 , 12 , 87 , 2};...
分类:
编程语言 时间:
2015-04-15 00:45:50
阅读次数:
163
string email = Console.ReadLine(); if (email.Contains("@") && email.Contains(".com")) { Console.WriteLine("这是一个正确的邮箱地址"); int intex = email.IndexOf("....
分类:
其他好文 时间:
2015-04-15 00:42:09
阅读次数:
127
先打上代码以后更新解释 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define REP(i, s, n) for(int i = s; i = s; i --) 8 #define LOW for(; x; x -=...
分类:
编程语言 时间:
2015-04-15 00:37:55
阅读次数:
393
如题思路:暴力就行了。1ms的暴力!!!别的牛人写出来的,我学而抄之~ 1 int strStr(char* haystack, char* needle) { 2 if (!haystack || !needle) return -1; 3 for (int i =...
分类:
其他好文 时间:
2015-04-15 00:36:25
阅读次数:
146
在源码中,这段是申请空间大小的,为那些子控件,不然你出现就没有地方显示了.
@Override
?protected?void?onMeasure(int?widthMeasureSpec,?int?heightMeasureSpec)?{
??final?int?radius?=?mRadi...
分类:
移动开发 时间:
2015-04-14 23:34:39
阅读次数:
412
程序(已经Accepted):
#include
/*
* 逆向思维,从(m,n)到(1,1),
* 给定(m,n),求其父亲,若m>n,则其父亲为(m-n,n),否则为(m,n-m),
* 但是这样做会TLE,这就需要用除法代替减法,加快速度,
* 也就是辗转相除法
* */
int main(void)
{
int n, a, b, l, r, temp, i;
...
分类:
其他好文 时间:
2015-04-14 23:26:06
阅读次数:
202
sds(简单动态字符串)是redis底层的字符串表示,它具有字符串对象化和替代char*的作用。数据库中的值类型包括字符串,哈希表,列表,集合和有序集合,但是键类型却总是字符串。
typedef char *sds;
struct sdshdr {
// buf 已占用长度
int len;
// buf 剩余可用长度
int free;
// 实际保存字符串数据的地方
char buf[];
...
分类:
其他好文 时间:
2015-04-14 23:23:05
阅读次数:
222
快速排序的精髓就在partition函数的实现。我们构建两个指针,将数组分为三部分,黑色部分全部小于pivot,中间蓝色部分都大于pivot,后面红色部分未知。i指针遍历整个数组,只要它指向的元素小于pivot就交换两个指针指向的元素,然后递增。// arr[]为数组,start、end分别为数组第一个元素和最后一个元素的索引
// povitIndex为数组中任意选中的数的索引
int part...
分类:
编程语言 时间:
2015-04-14 23:19:53
阅读次数:
183
Console.WriteLine("请输入您的身份证号码"); string x = Console.ReadLine(); string year=x.Substring (6,4);//从身份证的第六位开始截取,往后截取四位,就是你的出生年份 int x1 = Convert.ToInt32(...
分类:
其他好文 时间:
2015-04-14 23:18:10
阅读次数:
176
1 class BirthDate { 2 private int day; 3 private int month; 4 private int year; 5 6 public BirthDate(int d, int m, int y) { 7 ...
分类:
编程语言 时间:
2015-04-14 23:14:17
阅读次数:
185