上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 99 下一页

2011年7月27日

组合 二项式定理

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int c[1000];int c1[100][100];/* 排列与组合 c(n,k) = n ! / ( k! * (n - k)!)*//*1.求组合数利用等式2.利用杨辉三角*//*二项式定理(a + b) ^n = for k = 0 to nc(n,k) = a ^(n - k) * b ^k;*/ int main( ){ int i, j, n; while (scanf("%d", &n), n) { 阅读全文

posted @ 2011-07-27 20:58 more think, more gains 阅读(199) 评论(0) 推荐(0) 编辑

stl 全排列

摘要: #include <cstdio>#include <algorithm>#include <cstdlib>#include <string>#include <string.h>#include <iostream>using namespace std;//next_permutationint main( ){ int length, flag ; char str[1000]; while ( scanf("%s",str) != EOF ) { flag = 1; length = strl 阅读全文

posted @ 2011-07-27 20:16 more think, more gains 阅读(155) 评论(0) 推荐(0) 编辑

2011年7月24日

kmp 算法

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int next[1000];int nextval[1000];void get_next(char *str){ int i = 1 , j = 0, len; str[0] = strlen( (str + 1)); next[1] = 0; while ( i < str[0] ) { if ( j == 0 || str[i] == str[j] ) i++, j++, next[i] = j; else j = next[j]; 阅读全文

posted @ 2011-07-24 13:55 more think, more gains 阅读(219) 评论(0) 推荐(0) 编辑

2011年7月22日

A - Goldbach's Conjecture

摘要: A - Goldbach's ConjectureTime Limit: 1000MSMemory Limit: 65536K64bit IO Format: %I64d & %I64u [Submit] [Go Back] [Status] DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number great 阅读全文

posted @ 2011-07-22 12:03 more think, more gains 阅读(181) 评论(0) 推荐(0) 编辑

素MM 两次筛法

摘要: 1098: 素MMTime Limit: 1 SecMemory Limit: 128 MBSubmit: 52Solved: 30[Submit][Status][Web Board]Description素数有很多神奇的性质,所以很美。我们知道一个日期将年、月、日按顺序连接在一起可以组成一个八位数,例如2011年3月6日可以写成20110306。我的某个MM的生日组成的数是一个素数。偶尔我叫她素MM,没人知道是啥意思,她自己也不知道。O(∩_∩)O哈哈~我心里可是真的美美的(⊙o⊙)哦! 嗯,什么?你的生日也是素数?你也想做“素MM”或者“素GG”?那好吧,不过我可是很小气的哦!只有你出生 阅读全文

posted @ 2011-07-22 08:58 more think, more gains 阅读(450) 评论(0) 推荐(0) 编辑

上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 99 下一页

导航