码迷,mamicode.com
首页 > 其他好文
ural 1932 The Secret of Identifier (容斥原理)
题目大意: 求出给的n个串中。 精确到只有一个字符不同,两个字符不同,三个字符不同,四个字符不同的对数。 思路分析: 枚举状态。 dp[i] [j] ...表示当前串取出 i 状态下的所有字符转化成十进制数为 j 的出现的次数。 这样的话,就记录了所有串的子串的状态。 然后计数就得到了所有的状态。 然后我们要得到精确不同的,可以用补集的思想,如果要精确到三个不相同,意味着要...
分类:其他好文   时间:2014-08-04 21:33:48    阅读次数:262
POJ - 1006 Biorhythms (中国剩余定理)
Description Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they...
分类:其他好文   时间:2014-08-04 21:33:38    阅读次数:278
Leetcode--Divide Two Integers
Problem Description: Divide two integers without using multiplication, division and mod operator. 分析:题目意思很容易理解,就是不用乘除法和模运算求来做除法,很容易想到的一个方法是一直做减法,然后计数,但是提交之后显示超时,在网上找到一种解法,利用位运算,意思是任何一个整数可以表示成以2的幂为...
分类:其他好文   时间:2014-08-04 21:33:28    阅读次数:307
poj 3400 Dropping the stones
//next_permutation全排列 # include # include # include using namespace std; struct node { int w; int v; }; struct node a[10010]; int max1(int x,int y) { return x>y?x:y; } int main() { int i,n,d,fl...
分类:其他好文   时间:2014-08-04 21:33:18    阅读次数:279
【LeetCode】Pow(x, n)
Implement pow(x, n). 思路:快速幂运算,需要考虑指数为负数,同时底数为0的情况,这种属于异常数据,代码里没有体现。 class Solution { public: double pow_abs(double x, unsigned int n) { if (n == 0) { return 1;...
分类:其他好文   时间:2014-08-04 21:32:48    阅读次数:314
poj 2752 Seek the Name, Seek the Fame KMP
对于KMP算法中next函数的应用 题意是对于一个字符串的前缀和后缀比较是否相等,再把相等的可能按字符串长度进行输出 #include #include #include using namespace std; int len; int next[1000005]; char s[1000005]; int kmp_next() {     int i=0,j=-1; ...
分类:其他好文   时间:2014-08-04 21:32:38    阅读次数:239
SRBF Lighting
SRBF的全称是Spherical Radial Basis Function,我擅自翻译为球面放射基底函数。因为SRBF并不怎么出名,相对来说,SH(Spherical Harmonic)球谐函数更为出名(出现的也更早),而且在很多绘制引擎里用的也是SH,而不是SRBF。网上关于SRBF的资料也很少,这里写关于SRBF的文章,主要是针对对SRBF有兴趣的同学,一起探讨一下SRBF...
分类:其他好文   时间:2014-08-04 21:32:18    阅读次数:418
URAL 1933 Guns for Battle!
给一个n,要求构造一个矩阵,满足: 1、矩阵大小为(2n+1)*(2n+1) 2、沿对角线对称 3、每个数的值在[0,2n+1]上 4、每行每列没有重复的值 手动写了一下 直接找到规律。。 #include #include using namespace std; int n,m,i,j,cnt,s[205][205],k; int main() { wh...
分类:其他好文   时间:2014-08-04 21:32:08    阅读次数:255
HDU 4883 TIANKENG’s restaurant (贪心)
TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 658    Accepted Submission(s): 306 Problem Description TIANK...
分类:其他好文   时间:2014-08-04 21:31:39    阅读次数:238
URAL 1934 Black Spot --- 简单最短路变形
边权为1,在维护最短路的同时维护p值最小,我直接存的(1-q),即不遇见的概率,要使得这个值最大。 #include #include #include #include #include #include #include #include #include #include #define inf 0x3f3f3f3f #define eps 1e-6 #de...
分类:其他好文   时间:2014-08-04 21:31:38    阅读次数:426
两种方法求丑数
我们把只包含因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含因子7。 方法1 : 暴力破解,逐个判断 代码: #include #include using namespace std; //判断是否是丑数 bool isUgly(int index){ while(index % 2 == 0){ index /= 2...
分类:其他好文   时间:2014-08-04 21:30:58    阅读次数:313
poj 1979 Red and Black
Red and Black Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 22300   Accepted: 12041 Description There is a rectangular room, covered with square tiles. Each ...
分类:其他好文   时间:2014-08-04 21:30:48    阅读次数:263
POJ 1442 Black Box(优先队列)
题目地址:POJ 1442 这题是用了两个优先队列,其中一个是较大优先,另一个是较小优先。让较大优先的队列保持k个。每次输出较大优先队列的队头。 每次取出一个数之后,都要先进行判断,如果这个数比较大优先的队列的队头要小,就让它加入这个队列,队列头移到较小优先的队列中。然后当较大优先的数不足k个的时候,就让较小优先的队列的队头移到较大优先的队头中。 代码如下; #include #incl...
分类:其他好文   时间:2014-08-04 21:30:38    阅读次数:276
hdu1350Taxi Cab Scheme (最小路径覆盖)
Taxi Cab Scheme Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 712 Accepted Submission(s): 337 Problem Description Running a taxi stati...
分类:其他好文   时间:2014-08-04 21:30:08    阅读次数:272
STL--H - Black Box(两个优先队列,求第k小的值)
H - Black Box Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status Description Our Black Box represents a primitive database. It can save an int...
分类:其他好文   时间:2014-08-04 21:29:40    阅读次数:523
STL--G - For Fans of Statistics(两个判断条件-二分)
G - For Fans of Statistics Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description Have you ever thought about how many people are tran...
分类:其他好文   时间:2014-08-04 21:29:28    阅读次数:318
关于welcome-file-list(欢迎页)不起作用的解决办法
今天我遇到了一个问题,就是直接输入http://localhost:8080/xxx-admin/,不是跳转到index.html,而是报404找不到的错误,根据错误信息看明显是没有跳转到index.html,意思就是说welcome-file-list根本就木有起作用。只有我输入确切路径htt.....
分类:其他好文   时间:2014-08-04 21:27:57    阅读次数:352
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!