自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Hackbuteer1的专栏

走别人没走过的路,让别人有路可走。

  • 博客(17)
  • 资源 (1)
  • 收藏
  • 关注

原创 2011年北京大学计算机研究生机试真题(dijkstra+优先队列)

http://ac.jobdu.com/problem.php?pid=1162  I Wanna Go Home方法一:普通的dijkstra/*很明显的最短路,但关键是如何建图。可以看到,一共只有两种走法,一种是从city1出发,一直走属于group1的city直到city2,或者一直走属于group2的city直到city1。我昨天建了两个图来表示两种情况,分别求最短路,然后取

2012-02-29 15:38:06 3829 2

原创 2006年上海交通大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1095 2的幂次方//手动模拟#include#include#includeusing namespace std;int main(void){ int j,n,flag,m; int binary[15]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8

2012-02-29 11:30:49 3169 1

原创 2010年清华大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1085 求root(N, k) /*N =a0+a1*k+a2*k^2+......ar*k^r;N'=a0+a1 +a2 +......ar;N-N' = a1(k-1)+a2(k^-1)+......+ar(k^r-1)右边提取k-1,可以得出结论:(N-N')%(k-1)=0这样递

2012-02-27 22:01:02 3409

原创 2007年浙江大学计算机及软件工程研究生机试真题

http://ac.jobdu.com/problem.php?pid=1025  最大报销额//将题目中数字都扩大100倍变成整数,就可看作经典的01背包问题//设报销额度为背包上限,可报销支票金额为价格,可报销支票金额为重量//a[]存的既是价格,又是重量#include#includeusing namespace std;int a[32]; //存的既是价格,又是

2012-02-26 20:53:32 2745

原创 2006年清华大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1078二叉树遍历#include#include//二叉树结点的描述 typedef struct BinaryTreeNode { char data; struct BinaryTreeNode *lchild, *rchild; //左右孩子 }BinaryTreeNode,

2012-02-26 20:07:30 2601

原创 STL快速解题

http://ac.jobdu.com/problem.php?pid=1402    特殊的数#include#include#includeusing namespace std;void read(int &data) //快速读取数据{ char ch = getchar(); while (ch '9') ch = getchar(); data =

2012-02-26 15:39:39 2269

原创 2010年北京大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1149   子串计算#include#include#include#includeusing namespace std;int main(void){ string t,str; map mymap; map::iterator iter,p; int i,j; while(cin>>t)

2012-02-24 17:03:52 2586

原创 2010年浙江大学计算机及软件工程研究生机试真题

http://ac.jobdu.com/problem.php?pid=1006 ZOJ问题/*若azbjc 能AC,则azbojac也能AC,其中a,b,c为N个'o'或者为空;这里azbojac和azbjc相比 z和j中间+了一个o j后面就+了一个a 而z前面也有一个a以此类推如果再执行一次这个规定那么z和j中间就+了2个o 后面也+了2个前面的a ...所以z前面

2012-02-24 16:59:49 3022

原创 2008年浙江大学计算机及软件工程研究生机试真题

http://ac.jobdu.com/problem.php?pid=1029魔咒词典题目当中每个魔咒用一对括号[  ] 来包含,测试数据在一对括号当中会有空格,这个小问题导致一直是WA,应该首先把一行字符串都读进来,然后在分别提取出魔咒和对应的功能。方法一://使用双map来实现#include#include#include#includeusing namespace

2012-02-23 19:46:09 2483

原创 2009年浙江大学计算机及软件工程研究生机试真题

http://ac.jobdu.com/problem.php?pid=1035  找出直系亲属//floyd#include#include#includeint map[27][27];void floyd_warshall(int n){ int i,j,k; for(k=0;k<=n;k++) { for(i=0;i<=n;i++) { for(

2012-02-22 22:27:57 2415

原创 2008年清华大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1080 进制转换当然这个题目如果使用大数模板来做的话,也是可以AC的,话说我第一次就是用大数模板AC的,然后又改用了下面这个手动模拟相除的代码AC的。//这个题目有大数数据,需要进行模拟#include#includevoid m2nbinary(int m,int n,char *str,int len

2012-02-22 21:29:15 2697

原创 2011年吉林大学计算机研究生机试真题

http://ac.jobdu.com/problem.php?pid=1107     搬水果方法一:(优先队列)#include#include#includeusing namespace std;#includeint main(void){ int i,n,m,a,b,sum; //使用优先队列 priority_queue,greater >q;

2012-02-20 14:35:23 2659

原创 二叉排序树的建立和遍历

http://ac.jobdu.com/problem.php?id=1201   输入一系列整数,建立二叉排序数,并进行前序、中序、后序遍历。#include using namespace std;#include #include typedef struct BiTNode{ int value; struct BiTNode *lchild,*rc

2012-02-20 12:17:50 31091 4

原创 Kruscal算法+并查集 求解最小生成树

http://ac.jobdu.com/problem.php?id=1347    孤岛连通工程刚开始的时候使用qsort排序函数进行排序提交一直都是TLE,后来无意中改为sort排序函数提交就AC了,真是太神奇了。。。#include#includeusing namespace std;#includestruct Edge{ int x; int y

2012-02-16 19:31:49 4141 1

原创 2011年上海交通大学计算机研究生机试真题

整除问题http://ac.jobdu.com/problem.php?pid=1104#include#include#includeusing namespace std;#includeint prime[170],num;void findPrime(int n) { int i,j,k,flag; prime[0]=2; num=1; for(i=3

2012-02-15 22:32:42 3195

原创 九度OJ最短摘要的生成

使用滑动窗口的思想来获取最短摘要,可以达到O(N)的时间复杂度。http://ac.jobdu.com/problem.php?pid=1397#include #include #include #define MAX 100010char s[100010],p[100010];int hash[10],movewindow[10],len1,len2,minlen;in

2012-02-15 16:32:04 2636 1

原创 Runtime Error VS Accepted (大整数排序 )

读入字符串的两种不同方式导致两个截然不同的提交结果。。http://ac.jobdu.com/problem.php?id=1190下面这个代码提交结果是是Accepted #include#include#include#include using namespace std;struct BigNum{ int len; char str[101

2012-02-15 08:54:45 2081

快速筛选素数

快速筛选出10亿以内的素数和非素数

2012-04-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除