- 浏览: 378369 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
wsyzyrxp:
非常感谢 兄弟 帮了我大忙
[opengl]弹簧质点法模拟柔性布料以及椭球碰撞的opengl实现 -
mingdry0304:
[opengl]彩色立方体旋转 -
tyfengyu:
我刚刚更改的代码加上了标准差stdVal,故recoMat应该 ...
[python]用python实现的pca算法 -
tyfengyu:
python的pca代码有2处错误:1.finalData = ...
[python]用python实现的pca算法 -
暴风雪:
McFlurry 写道前排(凑字数)!擦你怎么摸来这里的
诈尸总结
/* ID: bbezxcy1 PROG: numtri LANG: C++ */ #include<iostream> #include<cstring> #include<cstdio> using namespace std; int n,map[1002][1002]; int main(){ int n,i,j,a,b,c; freopen("numtri.in","r",stdin ); freopen("numtri.out","w",stdout ); while(scanf("%d",&n)!=EOF){ for(i=1;i<=n;i++){ for(j=1;j<=i;j++){ scanf("%d",&map[i][j]); } } for(i=n-1;i>=1;i--){ for(j=1;j<=i;j++){ map[i][j]+=max(map[i+1][j],map[i+1][j+1]); } } printf("%d\n",map[1][1]); } return 0; }
//第二题,只把打表代码写上吧 #include<iostream> #include<cstring> #include<cstdio> #include<cmath> using namespace std; bool isPrim(int n){ int m=sqrt(n); if(n==2)return 1; for(int i=2;i <=m;i++){ if(n%i==0) return false; } return true; } bool isback(int n){ char str[20]; int len=0; while(n) { str[len++]=n%10; n/=10; } for(int i=0;i<len;i++){ if(str[i]!=str[len-i-1]){ return 0; } } return 1; } int main(){ int cnt=1; freopen("namenum.out","w",stdout ); cout<<2<<" "; for(int i=2;i<=100000000;i++){ if(i%2==0)continue; if(isPrim(i)&&isback(i)){ cnt++; printf("%d,",i); } } cout<<"cnt="<<cnt<<endl; return 0; }
/*
ID: bbezxcy1 PROG: sprime LANG: C++ */ #include<iostream> #include<cstring> #include<cmath> #include<cstdio> using namespace std; int len; bool check(int d) { int i; for (i=2;i<=(int)sqrt(d);i++) if (d%i==0) return true; return false; } int tail[5];//={1,3,7,9}; void dfs(int num,int dep) { if(dep==len) { printf("%d\n",num); return; } int a,i; for(i=0;i<4;i++) { a=num*10+tail[i]; if(check(a)) { dfs(a,dep+1); } } } int main() { freopen("sprime.in","r",stdin ); freopen("sprime.out","w",stdout ); tail[0]=1;tail[1]=3;tail[2]=7;tail[3]=9; while(scanf("%d",&len)!=EOF) { if(len==1){ printf("2\n3\n5\n7"); continue; } dfs(2,1); dfs(3,1); dfs(5,1); dfs(7,1); } return 0; }
/*
ID: bbezxcy1 PROG: checker LANG: C++ */ #include<fstream> #include<iostream> #include<cstring> #include<cstdio> using namespace std; int aaa[50],bbb[50],ccc[50],n,res[50],tot; ifstream fin("checker.in"); ofstream fout("checker.out"); void dfs(int dep) //dep代表当前的行 { int i; if(dep==n) { tot++; if(tot<=3) { for(i=0;i<n-1;i++) { fout<<res[i]+1<<" "; //printf("%d ",res[i]+1); }//printf("%d\n",res[n-1]+1); fout<<res[n-1]+1<<endl; } return; } for(i=0;i<n;i++) { if(!aaa[i]&&!bbb[dep-i+n]&&!ccc[i+dep]) { aaa[i]=bbb[dep-i+n]=ccc[i+dep]=1; res[dep]=i; dfs(dep+1); aaa[i]=bbb[dep-i+n]=ccc[i+dep]=0; } } } int main() { // freopen("checker.in","r",stdin ); // freopen("checker.out","w",stdout ); int i,j,a,b,c; while(fin>>n)//scanf("%d",&n)!=EOF { tot=0; memset(aaa,0,sizeof(aaa)); memset(bbb,0,sizeof(bbb)); memset(ccc,0,sizeof(ccc)); dfs(0); fout<<tot<<endl; //printf("%d\n",tot); } return 0; }
发表评论
-
Codeforces #285 (Div. 2) C - Misha and Forest
2015-01-12 20:26 693题意 给出一个无相无环图(树或者是森林),给出 ... -
[小模拟]zoj 3838
2014-11-30 18:52 894题意 问需要修改多少个点使得这个正方形完全对称 ... -
[模拟]hdoj 5071
2014-10-23 10:38 776大致题意: 自己读 大致思路: ... -
[水题]hdoj 5038
2014-09-25 17:21 570题意很简单,就是找众数,如果大家的值并不完全相同但是出现的次 ... -
[dfs][模拟]hdoj 5031
2014-09-25 12:31 1040大致题意: 右侧每个格子内的数字代表的是左边对应点上经 ... -
[贪心][位运算]hdoj 5014
2014-09-23 11:31 817大致题意 给出一列n个数a[n],每个数属于0--n,切每 ... -
[水题]hdoj 5003
2014-09-21 10:41 554没什么好说的,直接去套题目里面的式子就行 #includ ... -
[字符串+暴力]zoj 3818
2014-09-21 10:04 759题意: 给出一个字符串,问这个字符串去掉标点符号之 ... -
[水题]hdoj 4432:Sum of divisors
2012-10-27 18:02 1741大致题意: 把一个数的所有约数化为m进制之后,把这些数的 ... -
[模拟]zoj 3657:The Little Girl who Picks Mushrooms
2012-10-18 14:14 1326大致题意: 有五个山头可以采蘑菇,现在先给出n(n< ... -
[组合数学]zoj 3647:Gao the Grid
2012-10-11 21:34 1180http://acm.zju.edu.cn/onlinejud ... -
[模拟]zoj 3654:Letty's Math Class
2012-10-11 21:20 1167http://acm.zju.edu.cn/onlinejud ... -
[规律题]zoj 3629:Treasure Hunt IV
2012-08-31 08:11 1358大致题意: 现在规定数字n,如果[n/1] + [n ... -
[最长不降子序列]zoj 3523:Bookcase
2012-06-12 17:29 1064大致题意: 一个书架共有n层,每层m本书,现在要使得每一 ... -
[模拟]zoj 3326:An Awful Problem
2012-06-08 17:45 1001大致题意: 给出两个日期,求出两个日期中,月份为质数 ... -
[模拟+二分]zoj 3470:Magic Squares
2012-06-08 14:37 1010大致题意: 如题目中给出的图片 对于这样的一个无线 ... -
[usaco] Chapter2-Bigger Challenges(Section 2.4)
2012-05-26 08:53 843/* ID: bbezxcy1 PROG: ttwo ... -
[usaco] Chapter2-Bigger Challenges(Section 2.3)
2012-05-21 22:29 864/* ID: bbezxcy1 PROG: pref ... -
[usaco] Chapter2-Bigger Challenges(Section 2.2)
2012-05-16 17:21 723/* ID: bbezxcy1 PROG: subs ... -
[usaco] Chapter2-Bigger Challenges(Section 2.1)
2012-05-07 18:54 824/* 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是美国中学生的官方竞赛网站。是美国著名在线题库,专门为信息学竞赛选手准备。推荐直接阅读英语原文,既准确可靠又可提高英语水平。做题方式模拟正式比赛,采用标准测评机、文件...
USACO chapter one.May hope it useful to someone
Notes-USACO-2021-弹簧
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看
USACO chapter two.Useful for beginners.
我的USACO题解和程序
USACO培训网站 我为章节解决方案。 每个文件的多行USACO标识信息注释 第1章全部的解决方案 第2章全部的解决方案
Java中的USACO金问题 YYMM 姓名 文件夹 笔记 代码 1812 美食 1812 牛适应性 1812 团队合作
USACO培训页面美国计算机奥林匹克训练页2015年6月17日开始
丰富的USACO1.1--2.3.4的所有题解