C/C++如何产生随机数:这里要用到的是rand()函数, srand()函数,C语言/C++里没有自带的random(int number)函数。(1) 假设你仅仅要产生随机数而不须要设定范围的话,你仅仅要用rand()就能够了:rand()会返回一随机数值, 范围在0至RAND_MAX 间。RA...
分类:
编程语言 时间:
2014-07-07 15:25:20
阅读次数:
210
1990题意:每头牛有两个属性v,x,计算sigma(max(v[i],v[j])*abs(x[i]-x[j]))1=x[j] +sigma(v[j]*(x[j]-x[i])) x[i]=x[j]其中dist.sum(maxn)-dist.sum(x[i]) 就是坐标在[x[i],maxn]...
分类:
其他好文 时间:
2014-07-07 14:26:47
阅读次数:
292
tune2fs是调整和查看linux文件系统的文件系统参数,Windows下面如果出现意外断电死机情况,下次开机一般都会出现系统自检。Linux系统下面也有文件系统自检,而且是可以通过tune2fs命令,自行定义自检周期及方式。二.用法:tune2fs [ -l ] [ -c max-mount-c...
分类:
系统相关 时间:
2014-07-07 13:48:22
阅读次数:
213
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2014-07-03 11:53:07
阅读次数:
182
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100". 1 class Solution 2 { 3 public: 4 ...
分类:
其他好文 时间:
2014-07-03 11:23:54
阅读次数:
164
大意:一个DNA序列是环状的,这意味着有N个碱基的序列有N种表示方法(假设无重复)。而这N个序列有一种最小的表示,这个最小表示的意思是这个序列的字典序最小(字典序的意思是在字典中的大小 比如ABCusing namespace std;#define MAX 105int lessthan(char...
分类:
其他好文 时间:
2014-07-02 00:46:31
阅读次数:
372
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1,2,1...
分类:
其他好文 时间:
2014-07-01 00:23:01
阅读次数:
248
这里笔者只写出关键代码:int add(int n,intm){ if(m==0) returnn; ① int sum=n^m; ② int carry=(n&m)<<1; ③ return add(sum,carry); ④} 在分析每步代码之前先看两个例子...
分类:
其他好文 时间:
2014-06-30 23:50:59
阅读次数:
428
和操作一般nvarchar一样,要注意的一点就是SqlDbType.Nvarchar的长度设置为-1,new SqlParameter("@text",SqlDbType.NVarChar,-1) public bool AddMax() { StringBuilder str...
分类:
其他好文 时间:
2014-06-30 22:42:22
阅读次数:
270
简单,二分法,但是在oj上交的时候会有精度的限制,所以只能把数扩得大一点,而且在扩的时候为防止尾数会自动生成一些非零数,所以还是自己吧扩到的位置设置为0,还有输出时因为%.2lf会自己有4设5入,所以可以自己算出小数点后两位的数值,在输出,保证要求的精度
#include
#include
#include
#define MAX 10010
using namespace std;
l...
分类:
其他好文 时间:
2014-06-30 19:02:41
阅读次数:
163