2012年8月21日

整数中1出现的次数 分段算法

摘要: 算法:把1-100000000,分成10000段。每段100000,统计这一段的和。这题还可以用按位DP,组合数学做代码:View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using 阅读全文

posted @ 2012-08-21 23:00 more think, more gains 阅读(185) 评论(0) 推荐(0) 编辑

约数的个数

摘要: 算法:N = (1+p1)*(1+p2) *(1+p3)...*(1+pn)View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<algorithm>using namespace std;int n, a 阅读全文

posted @ 2012-08-21 20:52 more think, more gains 阅读(177) 评论(0) 推荐(0) 编辑

题目1207:质因数的个数

摘要: 题目1207:质因数的个数时间限制:1 秒内存限制:32 兆特殊判题:否提交:1397解决:326题目描述:求正整数N(N>1)的质因数的个数。相同的质因数需要重复计算。如120=2*2*2*3*5,共有5个质因数。输入:可能有多组测试数据,每组测试数据的输入是一个正整数N,(1<N<10^9)。算法:只要筛选出sqrt(1000000000)前面的素数即可。代码:View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#i 阅读全文

posted @ 2012-08-21 19:49 more think, more gains 阅读(296) 评论(0) 推荐(0) 编辑

题目1104:整除问题

摘要: 题目描述:给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除。输入:两个整数n(2<=n<=1000),a(2<=a<=1000)算法:分解N!和a 的因子...是否整除就看因子是否包含。。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include< 阅读全文

posted @ 2012-08-21 18:30 more think, more gains 阅读(190) 评论(0) 推荐(0) 编辑

求凸包

摘要: C-Dogs' HouseTime Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 134Accepted Submission(s) : 45Font:Times New Roman|Verdana|GeorgiaFont Size:←→Problem DescriptionGeorge wishes to build a House to contain his dogs(without roof), but he's a bit sh 阅读全文

posted @ 2012-08-21 16:39 more think, more gains 阅读(276) 评论(0) 推荐(0) 编辑

G-Wind

摘要: 算法:计算期望值,算出每棵蘑菇的概率,再乘以其期望。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<map>#include<iostream>#include<algorithm>#include<vector>using namespace std;struct pnode{ int h, x, l, r;}p[100100];struct qnode{ int x, w;}q[11000];int N, M;i 阅读全文

posted @ 2012-08-21 16:35 more think, more gains 阅读(195) 评论(0) 推荐(0) 编辑

E- Seven tombs 表达式运算 + DFS

摘要: 算法:1.表达式运算2.DFS枚举View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<stack>#include<algorithm>using namespace std;stack< 阅读全文

posted @ 2012-08-21 16:30 more think, more gains 阅读(199) 评论(0) 推荐(0) 编辑

题目1101:计算表达式 九度OJ

摘要: 算法:1.1个栈寄存运算符,1个栈寄存操作数2.优先级用数组保存好View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<vector>#include<string>#include<math.h>#include<map>#include<set>#include<stack>#include<algorithm>using namesp 阅读全文

posted @ 2012-08-21 08:49 more think, more gains 阅读(233) 评论(0) 推荐(0) 编辑

导航