
pku--ACM
小杰博客
这个作者很懒,什么都没留下…
展开
-
PKU ACM 题目分类
<br />pku上的题目分类<br />动态规划:<br />1037 A decorative fence、1050 To the Max、1088 滑雪、1125 Stockbroker Grapevine、1141 Brackets Sequence、1159 Palindrome、1160 Post Office、1163 The Triangle<br /><br />、1458 Common Subsequence、1579 Function Run Fun、1887 Testing the原创 2010-12-09 08:46:00 · 709 阅读 · 0 评论 -
pku-1664 放苹果(递推)
#include "stdio.h"#include "math.h"int f(int m, int n){ if(m<0) return 0; if(m==0||n==1) return 1; return f(m-n,n)+f(m,n-1);}int main(){ int a,b,t; scanf("%d",&t); while(t--)原创 2011-06-21 21:41:00 · 498 阅读 · 0 评论 -
pku--3126 prime road(注意数据范围BFS)
#include "iostream"#include "cmath"#include "queue"using namespace std;int mark[9999];int pri[9999];int lev[9999];int IsPrime(int n){ int i=2; while(i<=sqrt((float)n)) { i原创 2011-06-22 14:52:00 · 474 阅读 · 0 评论 -
pku--3278 catch the cow(*2 +1 -1 顺序抓补)
#include "iostream"#include "math.h"#include "queue"using namespace std;long mark[210000];struct node{ long num; long lev;};queue seq;node BFS(node s, node e){ node front,原创 2011-06-22 10:51:00 · 511 阅读 · 0 评论 -
poj--3984 迷宫问题(dfs)
#include "stdio.h"#include "math.h"int mark[6][6],savex[26],savey[26],minx[26],miny[26],cur,n,lenmin;int dir[8]={1,0,0,1,-1,0,0,-1};void DFS(int x,int y,int cur){ int i; if(x==4&&y==4)原创 2011-06-13 20:21:00 · 1606 阅读 · 0 评论 -
pku--上面题目分类学习指南(转)
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094) 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递原创 2011-06-10 11:13:00 · 736 阅读 · 0 评论 -
pku--3982 序列 (三个大数相加)
#include "stdio.h"#include "math.h"#include "string.h"int main(){ int i,j,m,k,len1,len2,len3,c; int a[102][50],max; char t1[10],t2[10],t3[10]; while(scanf("%s %s %s",t1,t2,t3)!=EOF)原创 2011-06-08 22:32:00 · 468 阅读 · 0 评论 -
pku--3751 时间格式转化
#include "stdio.h"#include "string.h"int main(){ int i,j,n,a1,b1,c1,d1,e1,f1,check; char s[25],end[3]; char a[5],b[5],c[5],d[3],e[3],f[3]; scanf("%d",&n); while(n--)原创 2011-06-06 14:57:00 · 417 阅读 · 0 评论 -
pku--3752 字母旋转
#include "stdio.h"#include "math.h"int main(){ int i,j,n,m,mmax,nmax,mmin,nmin; char a[1000][1000]; while(scanf("%d %d",&n,&m)!=EOF) { a[0][0]=A; nmax=n-1原创 2011-06-05 21:22:00 · 402 阅读 · 0 评论 -
pku-3750 小孩报数问题
#include "stdio.h"#include "string.h"int main(){ int i,j,a,b,k,n,m,len,start,the,end,stu[65],num; char s[65][16],ws[100],c; scanf("%d",&n); for (i=0;i<n;i++) { scanf("%s",s[i]); }原创 2011-06-03 21:38:00 · 1419 阅读 · 0 评论 -
pku--3981 给定字符串替换
#include "stdio.h"#include "string.h"int main(){ char s[10000],str[10000]; int i,j,k,len; while (gets(s)) { len=strlen(s); i=0;k=0; while(i<len) { if(s[i]==y&&s[i+1]==原创 2011-06-03 09:17:00 · 450 阅读 · 0 评论 -
pku--3979 分数加减法(注意分子为0,分母为1的情况)
#include "stdio.h"#include "string.h"int main(){ char s[10000],oper,a[10000],b[10000],c[10000],d[10000]; int i,j,k,len,ka,kb,kc,kd,numa,numb,numc,numd,up,down,up1,down1,com; while (gets(s)原创 2011-06-03 10:08:00 · 872 阅读 · 0 评论 -
PKU--3749 破译密码
#include "stdio.h"#include "string.h"int main(){ int i,j,k,n,m,len; char s[1000],a[1000],start[100],end[100]; while (gets(start)&&strcmp(start,"ENDOFINPUT")!=0) { gets(s); len=strl原创 2011-06-03 19:27:00 · 667 阅读 · 0 评论 -
pku--3278 catch the cow 方法二 不用结构体(BFS)
#include "iostream"#include "math.h"#include "queue"using namespace std;long mark[210000];long lev[210000];long BFS(long s, long e){ long front; memset(mark,0,sizeof(mark));原创 2011-06-22 11:22:00 · 510 阅读 · 0 评论