- 浏览: 378340 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
wsyzyrxp:
非常感谢 兄弟 帮了我大忙
[opengl]弹簧质点法模拟柔性布料以及椭球碰撞的opengl实现 -
mingdry0304:
[opengl]彩色立方体旋转 -
tyfengyu:
我刚刚更改的代码加上了标准差stdVal,故recoMat应该 ...
[python]用python实现的pca算法 -
tyfengyu:
python的pca代码有2处错误:1.finalData = ...
[python]用python实现的pca算法 -
暴风雪:
McFlurry 写道前排(凑字数)!擦你怎么摸来这里的
诈尸总结
/* ID: bbezxcy1 PROG: prefix LANG: C++ */ #include<fstream> #include<iostream> #include<cstring> #include<cstdio> using namespace std; char cha[203][15],str[200005]; int len[203]; bool dp[200005]; ifstream fin("prefix.in"); ofstream fout("prefix.out"); bool check(int loc,int a) { int j=len[a]-1; for(int i=loc;i>loc-len[a];i--,j--) { if(str[i]!=cha[a][j]) { return 0; } } return 1; } int main() { int n,i,j,k,ans,b,c; char buff[100]; while(fin>>cha[0]) { n=1; ans=0; len[0]=strlen(cha[0]); while(fin>>cha[n]) { if(cha[n][0]=='.') { break; } len[n]=strlen(cha[n]); n++; } fin>>str+1; while(fin>>buff) { strcat(str+1,buff); } // while(fin>>str+l) // { // l=strlen(str+1); // } memset(dp,0,sizeof(dp)); dp[0]=1; int l=strlen(str+1); // cout<<l<<endl; // cout<<n<<endl; for(i=1;i<=l;i++) { for(j=0;j<n;j++) { if(len[j]<=i&&dp[i-len[j]]==1) { // cout<<i<<" "<<j<<endl; if(check(i,j)) { ans=i; dp[i]=1; //cout<<i<<" fuck "<<j<<endl; } } } } fout<<ans<<endl; } return 0; }
/* ID: bbezxcy1 PROG: nocows LANG: C++ */ #include<iostream> #include<cstring> #include<fstream> #include<cstdio> using namespace std; ifstream fin("nocows.in"); ofstream fout("nocows.out"); int dp[300][300]; int main() { int n,k,i,j,m; while(fin>>n>>m) { memset(dp,0,sizeof(dp)); for(i=0;i<300;i++)dp[1][i]=1; for(i=3;i<=n;i++) { for(j=2;j<=m;j++) { for(k=1;k<=i-2;k++) { dp[i][j]+=dp[k][j-1]*dp[i-k-1][j-1]; dp[i][j]%=9901; } } } fout<<(dp[n][m]-dp[n][m-1]+9901)%9901<<endl; } return 0; }
/*
ID: bbezxcy1 PROG: zerosum LANG: C++ */ #include<iostream> #include<fstream> #include<stdio.h> using namespace std; ifstream fin("zerosum.in"); ofstream fout("zerosum.out"); int n; int num; char opera[20]; void print(){ int i; for(i=1;i<n;i++) fout<<i<<opera[i]; //printf("%d%c",i,opera[i]); fout<<n<<endl; } void dfs(int sum,int step,int bef){ if(step==n){ if(sum==0){ num++; if(num<=20){ print(); } } } else{ int next; opera[step]=' '; if(step<9) next=bef*10+step+1; else next=bef*100+step+1; int i=step-1; while(opera[i]==' '&&i>=0)i--; if(opera[i]=='+') dfs(sum+next-bef,step+1,next); if(opera[i]=='-') dfs(sum-next+bef,step+1,next); opera[step]='+'; next=step+1; dfs(sum+next,step+1,next); opera[step]='-'; next=step+1; dfs(sum-next,step+1,next); } } int main(){ fin>>n; num=0; opera[0]='+'; dfs(1,1,1); return 0; }
/*
ID: bbezxcy1 LANG: C++ PROG: money */ #include<cstdio> #include<iostream> #include<cstring> #include<fstream> using namespace std; ifstream fin("money.in"); ofstream fout("money.out"); long long dp[10001]; int v,n,t; int main() { fin>>v>>n; dp[0]=1; for (int i=1;i<=v;++i) { fin>>t; for (int j=t;j<=n;++j) dp[j]+=dp[j-t]; } fout<<dp[n]<<endl; return 0; }
/*
ID: bbezxcy1 PROG: concom LANG: C++ */ #include<iostream> #include<fstream> #include<cstring> #include<cstdio> using namespace std; const int nMax=110; const int mMax=300000; int ctrl[110]; class edge{ public: int u,v,nex,val; };edge e[mMax]; int k,head[nMax]; void addedge(int a,int b,int c){ // cout<<a<<" add "<<b<<" "<<c<<endl; e[k].u=a; e[k].v=b; e[k].val=c; e[k].nex=head[a]; head[a]=k;k++; } int n; bool vis[110]; void dfs(int loc){ // cout<<loc<<endl; int i; vis[loc]=1; for(i=head[loc];i;i=e[i].nex){ int v=e[i].v; if(vis[v])continue; ctrl[v]+=e[i].val; } for(i=head[loc];i;i=e[i].nex){ int v=e[i].v; if(vis[v])continue; if(ctrl[v]>50){ dfs(v); } } } ifstream fin("concom.in"); ofstream fout("concom.out"); int main() { int i,j,a,b,c; while(fin>>n) { k=1; memset(head,0,sizeof(head)); for(i=0;i<n;i++) { fin>>a>>b>>c; addedge(a,b,c); } for(i=1;i<=100;i++) { memset(vis,0,sizeof(vis)); memset(ctrl,0,sizeof(ctrl)); vis[i]=1; dfs(i); for(j=1;j<=100;j++) { if(j==i)continue; if(vis[j]) { fout<<i<<" "<<j<<endl; } } } } return 0; }
发表评论
-
[树状数组]poj 2299
2014-12-13 20:58 1873题意 求一列数字的逆序数。 思路 ... -
[树状数组]hdoj 1166
2014-12-12 01:21 2题意 http://acm.hdu.edu.cn/ ... -
[树状数组]hdoj 1166
2014-12-12 01:21 850题意 http://acm.hdu.edu.cn/ ... -
[离散化+线段树]poj2528
2014-12-01 23:16 581题意 给出每个海报的位置,问最后没有被完全覆盖 ... -
[线段树区间合并]poj 3667
2014-12-01 11:45 753i题意 和poj1823差不多,加了一个查 ... -
[线段树区间更新]poj 1823
2014-12-01 02:56 849题意 一个旅馆有n个房间,有m次操作,每次操作可 ... -
[线段树]poj 3368
2014-11-29 07:58 700题意 给出一串数字,有m次询问,每次询问[ab ... -
[线段树成段更新]poj 2777
2014-11-28 01:33 1088题意: 一段区间从1-n的初始颜色为1,每 ... -
[线段树]poj 2182
2014-11-27 23:13 580题意: n头牛站队,每头牛都有一个属于[ ... -
[线段树]poj 3264
2014-11-27 21:57 474题意 给出一串数字,m个询问,对于每次询问求出 ... -
[线段树成段更新]hdoj 1698
2014-11-27 21:00 686题意: 对一个线段上的值进行修改,一次可以把[i, ... -
[线段树成段更新]poj 3468
2014-11-27 12:43 663题意: 给出一串n个数,每次操作分为两种,分 ... -
[线段树]poj 2828
2014-11-26 22:02 688题意 n个人插队,每次某个人都会选择插入第i个 ... -
[线段树]hdoj 2795
2014-11-25 20:33 832题意:一个高h宽w的二维空间,每次放进去一个高为1,宽为a的 ... -
[线段树]hdoj 1394
2014-11-24 22:40 896题意 给出一列n个数字,每一个数字都和其他 ... -
[后缀数组]acdream 1430
2014-10-16 14:08 502大致题意: 求出一个字符串(len<=1 ... -
[KMP+乱搞]hdoj 4749
2014-10-11 15:22 742大致题意: 求文本串中最多能选出多少子串,使得这 ... -
[KMP]hdoj 4763
2014-10-10 11:39 658题意: 给出一个字符串,问是否存在这样的子串E使得 ... -
[后缀数组][二分]hdu 5008
2014-09-27 10:10 979大致题意: 给出一个长度小于100000的字符串 ... -
[线段树,单点更新]hdoj 1754:I Hate It
2012-10-21 21:33 1231大致题意: 给出一个数组,在线更新点的值,查询区 ...
相关推荐
usaco section2.3--section5.5源程序。。。。。。。。。。。。。。。。
usaco 3到6章讲解
usaco测试数据+标程 usaco的section1到section5的所有测试数据 以及标准程序
2 Chapter2 2.1 Section 2.1 2.2 Section 2.2 2.3 Section 2.3 2.4 Section 2.4 3 Chapter3 3.1 Section 3.1 3.2 Section 3.2 3.3 Section 3.3 3.4 Section 3.4 4 Chapter4 4.1 Section 4.1 4.2 Section 4.2 4.3 ...
pku acm上的一系列usaco题目都可以在这里找到测试数据以及源代码,不过题目的名字和pku上有得有点出入,需要自己去比较一下,2002年
pku acm上的一系列usaco题目都可以在这里找到测试数据以及源代码,不过题目的名字和pku上有得有点出入,需要自己去比较一下,2001年
USACO题目,Greedy Gift Givers
此c++代码实现了USACO上Bessie Come Home的问题,并运用了弗洛伊德算法
此C++程序是实现了USACO网站上的Magic Squares的问题。
资源包包括USACO 2001-2007年月赛的测试数据;usaco月赛十年题典(2000-2009),usaco月赛2002-2008题解。单独下载需资源分30分以上。为了方便编程爱好者,我这边统一下载打包。欢迎下载。
这是USACO2001-2007月赛全集。 usaco是美国中学生的官方竞赛网站。是美国著名在线题库,专门为信息学竞赛选手准备。推荐直接阅读英语原文,既准确可靠又可提高英语水平。做题方式模拟正式比赛,采用标准测评机、文件...
Notes-USACO-2021-弹簧
USACO chapter two.Useful for beginners.
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看
USACO chapter one.May hope it useful to someone
我的USACO题解和程序
USACO培训网站 我为章节解决方案。 每个文件的多行USACO标识信息注释 第1章全部的解决方案 第2章全部的解决方案
Java中的USACO金问题 YYMM 姓名 文件夹 笔记 代码 1812 美食 1812 牛适应性 1812 团队合作
USACO培训页面美国计算机奥林匹克训练页2015年6月17日开始
丰富的USACO1.1--2.3.4的所有题解