1.Ruby常用数据类型Numbers, Strings, Booleansmy_num = 25my_boollean = true (or false)my_string = "Ruby"2.Ruby常用数学计算操作符加(+) 减 (-)乘 (*)除(/)幂次方 (**)求余 (%)3...
分类:
其他好文 时间:
2014-09-28 19:38:45
阅读次数:
213
Description
The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of ...
分类:
其他好文 时间:
2014-09-28 19:34:34
阅读次数:
417
structvp{intvalue;intplace;};boolcomp(conststructvpa,conststructvpb){returna.valuetwoSum(vector&numbers,inttarget){vectorv;for(inti=0;itarget){break.....
分类:
其他好文 时间:
2014-09-28 14:27:32
阅读次数:
210
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-09-27 23:31:00
阅读次数:
186
#!/usr/bin/envpython
importrandom
importstring
importsys
similar_char=‘0OoiI1LpP‘
upper=‘‘.join(set(string.uppercase)-set(similar_char))
lower=‘‘.join(set(string.lowercase)-set(similar_char))
symbols=‘!#$%&\*+,-./:;=?@^_`~‘
numbers=‘123456789‘
group=(..
分类:
编程语言 时间:
2014-09-27 18:38:20
阅读次数:
192
C语言不要求检查下标的范围。当下标超出范围时,程序可能会执行不可预知的行为。看下这个程序:#include #define N 10 //int main(){ int a[N],i; printf("Enter %d numbers: ",N); for(i=0; i=0;...
分类:
编程语言 时间:
2014-09-27 01:26:59
阅读次数:
222
可以像筛选法那样标记 但是内存最多只能开1024的int数组 我用了位优化 用一个int 32 位标记32个数字 接下来就离线 排个序 算出第k大的哪个数
#include
#include
#include
using namespace std;
int a[10000000/32];
struct node
{
int x, y, id;
}b[50010];
int get(...
分类:
其他好文 时间:
2014-09-26 20:31:58
阅读次数:
162
题意:给定x、y,为[x,y]之间有多少个数的偶数位和减去奇数位和等于一。
个位是第一位。
例子: 10=1-0=1 所以10是这样的数
思路:数位dp[i][sum][ok] i位和为sum 是否含有前导0.
然后就是因为有负数 所以根据范围把0设置为100 然后最后和等于101则为所求的数。
代码:
[cpp]
view plaincopyprint?
#...
分类:
其他好文 时间:
2014-09-26 05:06:08
阅读次数:
228
第一项:重命名对象 execute sp_rename @objname='Nums',@newname ='Numbers',@objtype ='object'; go 这里要特别小心 @newname 这个参数不要带架构 如 :@newname ='dbo.Numbers' 这下就...
分类:
数据库 时间:
2014-09-26 01:00:57
阅读次数:
226
题意:
对于一个数的每个位上的数。
对于每个奇数,如果出现必须出现偶数次。
对于每个偶数,如果出现必须出现奇数次。
思路:
用三进制存储每个数出现的状态,0没出现,1出现奇数次,2出现偶数次。
然后其他和普通数位dp就一样了。
代码:
#include"cstdlib"
#include"cstdio"
#include"cstring"
#include"cmath"
#incl...
分类:
其他好文 时间:
2014-09-25 13:08:28
阅读次数:
240