上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: 这道题着实让无数人纠结,wa了n次n天,poj的discuss有大量的数据,wa的同学可以试一试。结果我把数据都过了还是wa,后来在discuss的帮助下终于ac了,判断是否有环要最先判断,例如如下的数据:4 4A#include#includeusing namespace std;int map... 阅读全文
posted @ 2011-11-11 20:19 DChipNau 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 大数,题目有点误解人。。。明明说VeryLongInteger但运算的却不是数字而是文本行#include#includeusing namespace std;char str1[1000005],str2[105];int main(){ scanf("%s",str1); while(scan... 阅读全文
posted @ 2011-11-10 21:18 DChipNau 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 水题 简单的博弈思想#include#includeusing namespace std;int main(){ int n,k; while(scanf("%d%d",&n,&k),n||k) { int i=n%(k+1); if(i!=1) printf("16\n"); else prin... 阅读全文
posted @ 2011-11-10 20:30 DChipNau 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 水题,应用简单dp,含i个字符的串的个数等于i-1个字符的串的个数*2(包扩加上0和加上1),再减去最后3个字符是011的情况。#include#includeusing namespace std;double dp[41];int main(){ memset(dp,0,sizeof(dp));... 阅读全文
posted @ 2011-11-10 19:50 DChipNau 阅读(93) 评论(0) 推荐(0) 编辑
摘要: copy来的思想,果然自己还很菜啊递归方程式如下(f(i,j)为i个砖头,第一排为j个的摆发):f(i,j)=f(i-j,j+1)+f(i-j,j+2)+...+f(i-j,floor((i-j-1)/2)#include#includeusing namespace std;double p[50... 阅读全文
posted @ 2011-11-06 20:53 DChipNau 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 水题,做1089太郁闷了所以刷了到水题,代码很笨,基本没有参考价值,只为看一眼快把我折磨死的气球。。。。。。。。。。。#include#includeusing namespace std;char str1[1005],str2[1005];int main(){ while(scanf("%s%... 阅读全文
posted @ 2011-11-06 18:44 DChipNau 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 我这辈子都会记住这个定理:n元循环群(a)中,元素a^m是(a)的生成元的充要条件是(n,m)=1.哎,郁闷。。。。#include#includeusing namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { i... 阅读全文
posted @ 2011-11-06 17:43 DChipNau 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 又见0-1背包,长度既是价值也是体积。#include#includeusing namespace std;int dp[100000];int cd[105];int main(){ int cd_sto; while(scanf("%d",&cd_sto)!=EOF) { int n; sca... 阅读全文
posted @ 2011-11-04 20:32 DChipNau 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 欧拉回路 在加上 并查集判断连通性,把每一个单词当做一个边,话说我一开始当做h路做的。。。。。#include#include#includeusing namespace std;int father[26],rank[26],r[26],c[26],mark[26];int find(int x... 阅读全文
posted @ 2011-11-03 23:19 DChipNau 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 各种序。。。。。。。。。。。#include#include#includeusing namespace std;void tree(char *s1,char *s2){ if(s1[0]=='\0') return; else if(s1[1]=='\0') { printf("%c",s1[... 阅读全文
posted @ 2011-10-30 15:09 DChipNau 阅读(98) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页