会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
chenjunjie1994
勤能补拙是良训,一分辛苦一分才。
博客园
首页
新随笔
订阅
管理
上一页
1
···
20
21
22
23
24
25
26
27
28
···
38
下一页
2014年10月1日
HDU 2049
摘要: 简单错排#include #include #include #define LL __int64using namespace std;LL Cnk[25][25];LL Dn[25];void initial(){ for(LL i=1;i<25;i++){ Cnk[i][0]=1; for...
阅读全文
posted @ 2014-10-01 10:07 chenjunjie1994
阅读(224)
评论(0)
推荐(0)
2014年9月28日
POJ 1715
摘要: 同样是确定某位上的数,当确定某一位后,其后面的排列数是确定的,所以可以用除法和取余数的方法来确定这一位的值#include #include #include using namespace std;int lim[10];bool vis[20];int ans[20],ansl;void ini...
阅读全文
posted @ 2014-09-28 21:52 chenjunjie1994
阅读(231)
评论(0)
推荐(0)
2014年9月27日
POJ 1306
摘要: 其实求的这个数的式子化简一下,就是C(N,M).....#include #include #include #define LL __int64using namespace std;LL N,M;LL myc(LL n,LL r){ LL sum=1; for(LL i=1;i<=r;i++) ...
阅读全文
posted @ 2014-09-27 11:11 chenjunjie1994
阅读(199)
评论(0)
推荐(0)
POJ 2436
摘要: 枚举病的组合,再把牛的状态与之作或运算,若值仍是病组合的状态,则可以加1,否则,跳过。#include #include #include using namespace std;int cow[1100],n,D,K;int ans;int hm(int k){ int h=0; while(k)...
阅读全文
posted @ 2014-09-27 10:55 chenjunjie1994
阅读(197)
评论(0)
推荐(0)
POJ 2249
摘要: 简单求组合数,直接运用公式。注意C(n,k)=C(n,n-k)。#include #include #include #define LL __int64using namespace std;LL myc(LL n, LL r){ LL sum=1; for(LL i=1;in-r?n-r:r; ...
阅读全文
posted @ 2014-09-27 09:20 chenjunjie1994
阅读(138)
评论(0)
推荐(0)
POJ 2245
摘要: 按字典序选一个六组合。简单DFS#include #include #include using namespace std;int se[20];int ans[20];void dfs(int ps,int position,int k){ if(position>k){ if(ps==6){...
阅读全文
posted @ 2014-09-27 09:12 chenjunjie1994
阅读(180)
评论(0)
推荐(0)
2014年9月26日
POJ 1942
摘要: 开始时竟然用了分情况讨论。仔细思考一下,哈哈,发现不过是多重集合的组合数而已。#include #include #include using namespace std;typedef __int64 u_int;u_int myc(u_int n,u_int r){ u_int sum=1; ...
阅读全文
posted @ 2014-09-26 23:33 chenjunjie1994
阅读(187)
评论(0)
推荐(0)
POJ 1019
摘要: //可能相当计算题了。按递增量为1,2,3,4,5划分,记录下第一个数字串的长度以及开始的位置。//然后判断出给出的位置属于增量的哪一段,再按等差数列计算它属于哪一个数字串,按在该数字串的位置计算数字,即可。#include #include #include #include #include u...
阅读全文
posted @ 2014-09-26 21:01 chenjunjie1994
阅读(123)
评论(0)
推荐(0)
2014年9月25日
POJ 1496
摘要: 看见discuss 上说买一送一,果然是这样的。与POJ 1850相同--!#include #include #include #include #include using namespace std;int M[30][30];char s[30];int num[30];void initi...
阅读全文
posted @ 2014-09-25 20:33 chenjunjie1994
阅读(193)
评论(0)
推荐(0)
POJ 1850
摘要: 逐位确定其上可填的字母,组合数学题。注意:当不符合规则时,要求输出0;#include #include #include #include #include using namespace std;int M[30][30];char s[30];int num[30];void initial(...
阅读全文
posted @ 2014-09-25 20:31 chenjunjie1994
阅读(139)
评论(0)
推荐(0)
POJ 3252
摘要: 折腾了很久。注意到,每一个数总是这样的形式的:1010101100100。。如,当110000到111000时,我们可以看成是从110000到110111的计数。最后特判111000即可。这时,我们需要记下前三们110中1与0的个数之差,以决定后三位取0的个数。所以,不妨预处理出0,1,10,100...
阅读全文
posted @ 2014-09-25 16:03 chenjunjie1994
阅读(193)
评论(0)
推荐(0)
2014年9月24日
POJ 1833
摘要: 使用STL中的next_permutation(opt1,opt2)函数更容易实现。opt1为数组头地址,opt2为数组长度。排列是按字典序的。当找到下一个排列时,返回真,否则返回假,此时,把原数组重排一次。#include #include #include using namespace std...
阅读全文
posted @ 2014-09-24 20:11 chenjunjie1994
阅读(147)
评论(0)
推荐(0)
POJ 2084
摘要: 第一题组合数学题。可以使用递推,设1与其他各数分别连边,假设N=3;若1-4,则圆分成两部分计数,此时可以利用乘法原理。(高精度)#include #include #include #include using namespace std;const int maxn = 200;struct b...
阅读全文
posted @ 2014-09-24 19:41 chenjunjie1994
阅读(266)
评论(0)
推荐(0)
2014年9月17日
POJ 2447
摘要: 挺水的一题。其实只要理解了RSA算法,就知道要使用大整数分解的方法来直接模拟了。不过,要注意两个INT64的数相乘来超范围#include #include #include #include #include #include #define LL __int64 using namespace ...
阅读全文
posted @ 2014-09-17 22:26 chenjunjie1994
阅读(320)
评论(0)
推荐(0)
HDU 1211
摘要: 水。模拟即可。使用EXGCD求逆元#include #include #include #include #define LL __int64using namespace std;LL p,q,e,n,f,d;void exgcd(LL a,LL b,LL &x,LL &y){ if(b==0){...
阅读全文
posted @ 2014-09-17 21:15 chenjunjie1994
阅读(178)
评论(0)
推荐(0)
上一页
1
···
20
21
22
23
24
25
26
27
28
···
38
下一页