- 浏览: 380359 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
wsyzyrxp:
非常感谢 兄弟 帮了我大忙
[opengl]弹簧质点法模拟柔性布料以及椭球碰撞的opengl实现 -
mingdry0304:
[opengl]彩色立方体旋转 -
tyfengyu:
我刚刚更改的代码加上了标准差stdVal,故recoMat应该 ...
[python]用python实现的pca算法 -
tyfengyu:
python的pca代码有2处错误:1.finalData = ...
[python]用python实现的pca算法 -
暴风雪:
McFlurry 写道前排(凑字数)!擦你怎么摸来这里的
诈尸总结
/* ID:bbezxcy1 PROG: milk LANG: C++ */ #include<cstring> #include<algorithm> #include<cstdio> #include<iostream> using namespace std; class fuck{ public: int val,num; }sum[10000]; bool cmp(fuck a,fuck b){ if(a.val<b.val){ return 1; } return 0; } int main(){ int need,loc,n,i,j,a,b,c,ans; freopen("milk.in","r",stdin ); freopen("milk.out","w",stdout ); while(scanf("%d%d",&need,&n)!=EOF){ ans=0; for(i=0;i<n;i++){ scanf("%d%d",&sum[i].val,&sum[i].num); } sort(sum,sum+n,cmp); loc=0; while(need!=0){ if(need-sum[loc].num>0){ need-=sum[loc].num; ans+=sum[loc].num*sum[loc].val; loc++; } else{ ans+=need*sum[loc].val; break; } } printf("%d\n",ans); } return 0; }
/* ID:bbezxcy1 PROG: barn1 LANG: C++ */ #include<iostream> #include<cstring> #include<fstream> #include<cstdio> #include <algorithm> using namespace std; const int nMax=1000; int dis[nMax],pos[nMax]; int main(){ int m,s,c,i,j,a,b,n,ans; freopen ( "barn1.in", "r", stdin ); freopen ( "barn1.out", "w", stdout ); while(scanf("%d%d%d",&m,&s,&c)!=EOF){ for(i=0;i<c;i++){ scanf("%d",&pos[i]); } if(m>=c){ cout<<c<<endl; continue; } sort(pos,pos+c); ans=pos[c-1]-pos[0]; for(i=0;i<c-1;i++){ dis[i]=pos[i+1]-pos[i]; } sort(dis,dis+c-1); b=m; m--; a=c-2; while(m--&&a>=0){ ans-=dis[a]; // cout<<"dis"<<dis[a]; // cout<<" ans"<<ans<<endl; a--; } cout<<ans+b<<endl; } return 0; }
/*
ID: bbezxcy1 PROG: calfflac LANG: C++ */ #include<iostream> #include<cstring> #include<fstream> #include<cstdio> using namespace std; const int nMax=200000; int p[nMax]; char str1[nMax]; void build(char *str,int len) { //abc-->@#a#b#c# int i=0,j; str1[0]='@';//开始加入另特殊字符 str1[1]='#'; j=2; for(i=0;i<len;i++ ){//在每个字符两边都插入一个特殊字符 str1[j++]=str[i]; str1[j++]='#'; } str1[j]='\0'; } int ps; int manacher(){ int idd,mxx=0,maxx=0,record; memset(p,0,sizeof(p)); for(int i=strlen(str1);i>=0;i--){ if( mxx>i ) p[i]=min(mxx-i, p[2*idd-i]); else p[i]=1; while(str1[i+p[i]]==str1[i-p[i]]) p[i]++; if( i+p[i]>mxx ){ mxx=i+p[i]; idd=i; } if( p[i]>maxx){ maxx=p[i]-1;//P[id]-1就是该回文子串在原串中的长度 record=i; ps=record; } } return maxx; } int main(){ char c; int len,a,b,n,i; int pos[nMax]; char str[nMax],abc[nMax]; len=n=0; freopen ( "calfflac.in", "r", stdin ); freopen ( "calfflac.out", "w", stdout ); // cin>>str; // cout<<str<<endl; while(scanf("%c",&c)!=EOF){ str[len]=c; if((c>='a'&&c<='z')||(c>='A'&&c<='Z')){ if(c>='a'&&c<='z'){ abc[n]=c; } else{ abc[n]=c+'a'-'A'; } pos[n]=len; n++; } len++; } abc[n]='\0'; //cout<<endl<<abc<<endl; build(abc,n); a=manacher(); //回文串长度 cout<<a<<endl; // cout<<ps<<"ps"<<endl; if(ps%2==1){ ps=ps/2-1; // cout<<ps<<endl; for(i=pos[ps-a/2+1];i<=pos[ps+a/2];i++){ cout<<str[i]; }cout<<endl; } else{ ps=ps/2-1; // cout<<ps<<endl; for(i=pos[ps-a/2];i<=pos[ps+a/2];i++){ cout<<str[i]; }cout<<endl; } return 0; }
/*
ID:bbezxcy1 PROG: crypt1 LANG: C++ */ #include<iostream> #include<cstring> #include<cstdio> using namespace std; int num[30],tmp[30]; int ans,n; bool shit[30]; bool innum(int a){ int i,j,b,c; while(a){ b=a%10; a/=10; if(shit[b]!=1){ return 0; } } return 1; } bool check(){ int a=tmp[0]*100+tmp[1]*10+tmp[2]; int b=tmp[3]*10+tmp[4]; int c=tmp[3]*a; int d=tmp[4]*a; int e=c+10*d; if(c<100||c>=1000||d<100||d>=1000){ return 0; } if(e<1000||e>=10000){ return 0; } if(innum(c)&&innum(d)&&innum(e)){ return 1; } return 0; } void dfs(int dep){ if(dep==5){ if(check()){ // for(int i=0;i<5;i++) // { // cout<<tmp[i]<<" "; // }cout<<endl; ans++; } return; } for(int i=0;i<n;i++){ tmp[dep]=num[i]; dfs(dep+1); } } int main(){ int i,j,a,b,c; freopen("crypt1.in","r",stdin ); freopen("crypt1.out","w",stdout ); while(scanf("%d",&n)!=EOF){ memset(shit,0,sizeof(shit)); for(i=0;i<n;i++){ scanf("%d",&num[i]); shit[num[i]]=1; } ans=0; dfs(0); printf("%d\n",ans); } return 0; }
发表评论
-
Codeforces #285 (Div. 2) C - Misha and Forest
2015-01-12 20:26 703题意 给出一个无相无环图(树或者是森林),给出 ... -
[小模拟]zoj 3838
2014-11-30 18:52 898题意 问需要修改多少个点使得这个正方形完全对称 ... -
[模拟]hdoj 5071
2014-10-23 10:38 784大致题意: 自己读 大致思路: ... -
[水题]hdoj 5038
2014-09-25 17:21 578题意很简单,就是找众数,如果大家的值并不完全相同但是出现的次 ... -
[dfs][模拟]hdoj 5031
2014-09-25 12:31 1045大致题意: 右侧每个格子内的数字代表的是左边对应点上经 ... -
[贪心][位运算]hdoj 5014
2014-09-23 11:31 826大致题意 给出一列n个数a[n],每个数属于0--n,切每 ... -
[水题]hdoj 5003
2014-09-21 10:41 560没什么好说的,直接去套题目里面的式子就行 #includ ... -
[字符串+暴力]zoj 3818
2014-09-21 10:04 768题意: 给出一个字符串,问这个字符串去掉标点符号之 ... -
[水题]hdoj 4432:Sum of divisors
2012-10-27 18:02 1758大致题意: 把一个数的所有约数化为m进制之后,把这些数的 ... -
[模拟]zoj 3657:The Little Girl who Picks Mushrooms
2012-10-18 14:14 1339大致题意: 有五个山头可以采蘑菇,现在先给出n(n< ... -
[组合数学]zoj 3647:Gao the Grid
2012-10-11 21:34 1191http://acm.zju.edu.cn/onlinejud ... -
[模拟]zoj 3654:Letty's Math Class
2012-10-11 21:20 1181http://acm.zju.edu.cn/onlinejud ... -
[规律题]zoj 3629:Treasure Hunt IV
2012-08-31 08:11 1362大致题意: 现在规定数字n,如果[n/1] + [n ... -
[最长不降子序列]zoj 3523:Bookcase
2012-06-12 17:29 1070大致题意: 一个书架共有n层,每层m本书,现在要使得每一 ... -
[模拟]zoj 3326:An Awful Problem
2012-06-08 17:45 1009大致题意: 给出两个日期,求出两个日期中,月份为质数 ... -
[模拟+二分]zoj 3470:Magic Squares
2012-06-08 14:37 1017大致题意: 如题目中给出的图片 对于这样的一个无线 ... -
[usaco] Chapter2-Bigger Challenges(Section 2.4)
2012-05-26 08:53 849/* ID: bbezxcy1 PROG: ttwo ... -
[usaco] Chapter2-Bigger Challenges(Section 2.3)
2012-05-21 22:29 870/* ID: bbezxcy1 PROG: pref ... -
[usaco] Chapter2-Bigger Challenges(Section 2.2)
2012-05-16 17:21 728/* ID: bbezxcy1 PROG: subs ... -
[usaco] Chapter2-Bigger Challenges(Section 2.1)
2012-05-07 18:54 829/* ID:123ldss2 PRO ...
相关推荐
usaco 3到6章讲解
usaco section2.3--section5.5源程序。。。。。。。。。。。。。。。。
usaco测试数据+标程 usaco的section1到section5的所有测试数据 以及标准程序
USACO1-5单元AC的代码~ 1 Chapter1 1.1 Section 1.1 1.2 Section 1.2 1.3 Section 1.3 1.4 Section 1.4 1.5 Section 1.5 2 Chapter2 2.1 Section 2.1 2.2 Section 2.2 2.3 Section 2.3 2.4 Section 2.4 3 Chapter3 ...
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 one.May hope it useful to someone
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看
USACO chapter two.Useful for beginners.
我的USACO题解和程序
USACO培训网站 我为章节解决方案。 每个文件的多行USACO标识信息注释 第1章全部的解决方案 第2章全部的解决方案
Java中的USACO金问题 YYMM 姓名 文件夹 笔记 代码 1812 美食 1812 牛适应性 1812 团队合作
usaco1.3解题报告1
USACO培训页面美国计算机奥林匹克训练页2015年6月17日开始