码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
hdu 1829:A Bug's Life
并查集 思路别人的 再设一个sex数组 记录与其性别不同的bug的编号 如果已经记录了 则将其和记录的值并到一起 以为性别相同 路漫漫其修远兮 下句忘了。。。 #include #include int set[2005]; int sex[2005]; int temp; int find(int x) { return set[x]==x?x:set[...
分类:其他好文   时间:2015-08-07 11:05:25    阅读次数:80
JS验证
//邮箱验证function checkEmail(str) { var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/ if (re.test(str)) { return true; } else { return...
分类:Web程序   时间:2015-08-07 10:59:34    阅读次数:122
php获取文件名
文件名路径中包含有中文的,如何获取文件名$str='中文/中文/匆匆那年.mp3';echo get_basename($str1);function get_basename($filename){ return preg_replace('/^.+[\\\\\\/]/', '', $fil...
分类:Web程序   时间:2015-08-07 10:57:52    阅读次数:130
*Binary Tree Preorder Traversal
题目:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]....
分类:其他好文   时间:2015-08-07 10:56:38    阅读次数:112
printf那点事
1、打印内存地址 #include int main() { int a; printf("%p\n",&a); //%p打印地址,自动加前缀00 printf("0x%x\n",&a); //%x以十六进制打印 return 0; }输出结果: 0012FF44 0x12ff44 2、printf,sprintf,snprintf 原型: in...
分类:其他好文   时间:2015-08-07 09:36:39    阅读次数:120
Leetcode解题笔记-Reverse Words in a String
题目要求:给定一个字符串由不同单词组成,返回其相反顺序,中间可能有多余字符:例如:Given s = "the sky is blue",return "blue is sky the".个人解法:1.暴力,主要是对于两个单词中间存在多个空格的处理。2. 利用栈来存储临时变量。3.缺点,空间利用太大...
分类:其他好文   时间:2015-08-07 07:05:41    阅读次数:115
os.path.exists(path) 和 os.path.lexists(path) 的区别
使用os.path.exists()方法可以直接判断文件是否存在。代码如下:>>> import os>>> os.path.exists(r'C:\1.TXT')False>>> os.path.exists(path)Return True if path refers to an existi...
分类:其他好文   时间:2015-08-07 06:59:54    阅读次数:132
c++ _ 模板与泛型编程
例子:比较两个值的函数模板template int compare(const T &t1, const T &t2) { if (t2 < t1) return 1; if (t1 < t2) return -1; return 0; }编写泛型代码的两个重要原则: 1 模板中函数参数是const的引用 2 函数体中条件判断仅适用<比较运算符模...
分类:编程语言   时间:2015-08-07 01:51:25    阅读次数:195
二分查找算法
public static int BinarySearch(int[] arr, int low, int high, int key){ int mid = (low + high) / 2; if (low > high) return -1; else ...
分类:编程语言   时间:2015-08-07 01:38:33    阅读次数:129
【LeetCode】67 - Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".Solution:二进制加法,和为2进1,和为3进1留1; 1 class Solution ...
分类:其他好文   时间:2015-08-07 00:22:07    阅读次数:354
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!