上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页
摘要: 求最长回文串 就是将字符串翻转后求最长公子列.....#include #include #include #include using namespace std;char str[1010];char re[1010];int f[1010][1010];int main(){ int t... 阅读全文
posted @ 2013-08-15 11:09 xlc2845 阅读(110) 评论(0) 推荐(0)
摘要: 计算一个 32 位无符号整数有多少个位为1Counting out the bits 可以很容易的判断一个数是不是2的幂次:清除最低的1位(见上面)并且检查结果是不是0.尽管如此,有的时候需要直到有多少个被设置了,这就相对有点难度 了。 GCC有一个叫做__builtin_popcount的内建函数... 阅读全文
posted @ 2013-08-15 10:15 xlc2845 阅读(2742) 评论(0) 推荐(0)
摘要: fill函数的作用是:将一个区间的元素都赋予val值。函数参数:fill(first,last,val);//first为容器的首迭代器,last为容器的末迭代器,val为将要替换的值。例题:给你n个数,然后输入一些操作:start,end,paint。表示从start到end都赋予paint的值,... 阅读全文
posted @ 2013-08-15 10:12 xlc2845 阅读(846) 评论(0) 推荐(0)
摘要: 简单题 记得uva上有个一样的 画个图就好了#include #include const double pi = acos(-1);int main (){ int a,b,s,m,n; while(scanf("%d%d%d%d%d",&a,&b,&s,&m,&n) == 5) ... 阅读全文
posted @ 2013-08-15 09:39 xlc2845 阅读(113) 评论(0) 推荐(0)
摘要: 概率 Q += p*pow(1-p, i*n+k-1) i = 0,1,2,3......#include #include int main (){ int t; scanf("%d",&t); while(t--) { int n,k; dou... 阅读全文
posted @ 2013-08-14 20:39 xlc2845 阅读(102) 评论(0) 推荐(0)
摘要: 栈应用 ...... 水题#include#include#include#include#includeusing namespace std;int a[1010], b[1010];int main(){ int n; while(scanf("%d",&n) == 1 && n)... 阅读全文
posted @ 2013-08-14 10:54 xlc2845 阅读(108) 评论(0) 推荐(0)
摘要: 最多的那个数字要超过(n+1)/ 2 排一下序 输出中间的值 #include#include#include#include#includeusing namespace std;int a[1000010];bool cmp(int q, int p){ return q > p;}in... 阅读全文
posted @ 2013-08-14 10:25 xlc2845 阅读(138) 评论(0) 推荐(0)
摘要: 递推#include#include#include#include#includeusing namespace std;int a[130];void init(){ memset(a, 0 , sizeof(a)); a[0] = 1; for(int i = 1; i <=... 阅读全文
posted @ 2013-08-13 20:22 xlc2845 阅读(92) 评论(0) 推荐(0)
摘要: 大数#include#include#include#include#includeusing namespace std;int a[2000];int main(){ int t; scanf("%d",&t); while(t--) { int n; ... 阅读全文
posted @ 2013-08-13 20:12 xlc2845 阅读(81) 评论(0) 推荐(0)
摘要: 好水......#include#include#include#include#includeusing namespace std;int a[20], b[20];int main(){ int A,D; while(scanf("%d%d",&A, &D) == 2 && A+D... 阅读全文
posted @ 2013-08-13 20:02 xlc2845 阅读(130) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页