自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(57)
  • 资源 (6)
  • 收藏
  • 关注

原创 1046. Shortest Distance

http://pat.zju.edu.cn/contests/pat-a-practise/1046dis[1]: 1-2的距离dis[2]: 1-3的距离..dis[n-1]: 1-n的距离dis[n]:       1-n-1的距离  即,整个环的长度,正着走的距离+反着走的距离=环长#include #include int dis[100010];in

2013-02-26 19:55:04 449

原创 1041. Be Unique

http://pat.zju.edu.cn/contests/pat-a-practise/1041本题若用c++的cin,超时#include int a[100001];int b[100001];//bool mark[100001];int main(){int n,i;scanf("%d",&n);for (i=1;i<=n;i++){ scanf("

2013-02-26 18:22:28 249

原创 1040. Longest Symmetric String

http://pat.zju.edu.cn/contests/pat-a-practise/1040c++中,带空格字符串的输入#include #include using namespace std;int getSym(string str,int pos){ int len=str.length(); int num1=0,num2=0,low,high; /

2013-02-26 16:23:12 278

原创 1037. Magic Coupon_两数字序列乘法

http://pat.zju.edu.cn/contests/pat-a-practise/10371、两个序列做乘法,steps=较小的那个序列长度2、排序之后,负数在前,正数在后。从前往后乘,遇到正数时,再从后往前做正数乘法     核心在于,循环退出条件#include #include using namespace std; int coup

2013-02-21 16:36:26 674

原创 1036. Boys vs Girls_排序

http://pat.zju.edu.cn/contests/pat-a-practise/1036读懂题意,第一行输出女生,不存在输出Absent                  第二行输出男生,不存在输出Absent bool f1,f2=false;                 应该是bool f1=false,f2=false;         考试时,这样浪费时间就被拒

2013-02-21 15:44:54 274

原创 1035. Password

http://pat.zju.edu.cn/contests/pat-a-practise/1035//字符串转换,输出   使用c++下的string类,此时不能用c的scanf。printf。。switch case 语句的使用,vector容器的使用输出的字符串要仔细比对,看细节,there is 与 there are 不同...#include #inclu

2013-02-21 15:05:15 544

原创 1032. Sharing _两链表的相交处地址

http://pat.zju.edu.cn/contests/pat-a-practise/1032用数组实现静态链表,并不对字符操作,所以不需要设置结构体,只用保存下一结点地址即可定义标技术组mark[i],与node[i]相对应,遍历一趟第一个链表,将所有点标记已访问遍历第二个链表,若访问到已访问过的结点则说明,两链表相交,输出此时地址即可#include #include

2013-02-21 13:56:34 294

原创 1030. Travel Plan_dijkstra算法升级

http://pat.zju.edu.cn/contests/pat-a-practise/1030输出两个城市间的最短路径值,路径经过的结点使用dikstra算法,邻接表保存图,使用栈输出保存的路径理解edge[i]   结点i的邻接链表,保存与i相邻接的边,边结构体保存next,cost,distance理解路径:每当有更短路径经过newP到t,则path[t]=newP,所以

2013-02-21 11:43:15 316

原创 1029. Median_两序列中间数

http://pat.zju.edu.cn/contests/pat-a-practise/1029因为给出的两个数字序列都是递增的,所以归并排序,时间复杂度最小若使用vector,sort,超时输入有大数据,或者非常多次输入时,使用scanf ,printf 而不是用cin,cout(超时)std::merge,所以using namespace std;long 型数据,%

2013-02-20 19:33:36 534

原创 1028. List Sorting_结构体排序

http://pat.zju.edu.cn/contests/pat-a-practise/1028简单的结构体排序#include#include#includeusing namespace std;struct E{ char num[10]; char name[10]; int score; }buf[100010];

2013-02-20 18:22:45 406

原创 1027. Colors in Mars_栈_进制转换

http://pat.zju.edu.cn/contests/pat-a-practise/1027//都要输出#,所以初始化ans就带上#//火星制(本题13),10进制的12,相当于c,是一位输出,所以添'0'//容器的使用:辗转求余得到每一位,先得到低位,却先输出高位,所以使用栈#include #include #include using namespace s

2013-02-20 18:10:51 235

原创 1025. PAT Ranking

http://pat.zju.edu.cn/contests/pat-a-practise/1025灵活掌握容器的使用#include #include #include #include using namespace std;struct stu{ string no; int score; int location; //

2013-02-20 17:23:46 270

原创 1024. Palindromic Number

http://pat.zju.edu.cn/contests/pat-a-practise/1024判断回文数,通过翻转求和若干次将输入变为一个回文数例:67 + 76 = 143, and 143 + 341 = 484.  2步通过本题,掌握c++字符串#include #include #include //reverse函数用到usin

2013-02-20 15:50:27 452

原创 1023. Have Fun with Numbers

http://pat.zju.edu.cn/contests/pat-a-practise/1023输入:1234567899输出 :Yes         2469135798给出一个大数(a),看它的2倍(b)是否符合以下规则:如a中9出现两次,那么b中9也只能出现两次,但可以在不同的位置上sign的使用意义: 例:1234 与 4231 从

2013-02-20 14:36:19 369

原创 1020. Tree Traversals

http://pat.zju.edu.cn/contests/pat-a-practise/1020输入:二叉树中后序序列***********输出:层序1、动态分配结点空间2、前中(后中)------>建树----->层序输出  熟练掌握相关算法3、熟练使用queue+vector#include #include //使用malloc函数,也可用std

2013-02-20 11:34:12 299

原创 1019. General Palindromic Number_回文数

http://pat.zju.edu.cn/contests/pat-a-practise/1019不要漏掉0的情况,且特殊情况处理后,return#include int a[40]; //10^9转化为2进制不超过40位int size=0;bool isPalindromic(int n,int b){ int i,j; while (n)

2013-02-19 18:45:32 471

原创 1015. Reversible Primes_逆素数

http://pat.zju.edu.cn/contests/pat-a-practise/1015素数(质数):只能被1或自身整除的大于1的正整数   基本方法:判断2 ~ sqrt(n)之间没有n的因子.                        素数与进制无关                     10进制37是素数,其相应2进制 100101,8进制45,都是素数

2013-02-19 18:15:11 423

原创 1013. Battle Over Cities

http://pat.zju.edu.cn/contests/pat-a-practise/1013大意:畅通工程的升级版。n个城市,m条路,删除某个城市,检测剩余城市是否连通,输出能连通需要新增的最少边数1、图的邻接矩阵表示法2、dfs算法得到图的连通分量3、删除图中结点及其相关边,对剩余结点及其边的dfs4、操作都是针对tmp矩阵,每次检查都重新给tmp赋初始值,特

2013-02-19 16:27:23 340

原创 1011. World Cup Betting

http://pat.zju.edu.cn/contests/pat-a-practise/1011也可使用二维数组,但i,j循环容易搞错边界使用多个数组,虽然代码长,但清晰。注意浮点输入输出,清空数组#include #include void change(int x) //找出概率最大的,输出胜,平或输{ if (x==1) { p

2013-02-19 14:14:20 340

原创 1009. Product of Polynomials

多项式的积http://pat.zju.edu.cn/contests/pat-a-practise/10091、理解该形式下,多项式积的定义2、数据格式,浮点输入输出3、使用数组先清空,谨慎#include #include int main(){ int k,i,j,c; //多项式的项,不超过10项,c,e暂存输入的指数与系数

2013-02-19 13:33:45 309

原创 1008. Elevator

http://pat.zju.edu.cn/contests/pat-a-practise/1008弄明白 if ..if..if...yu  if ..else if..else if...区别前者,每次从上到下挨个判断后者,每次循环只能选择一个判断#include int main(){ int n,i,current=0; //当前层current in

2013-02-19 11:02:36 296

原创 1006. 开门人关门人_时间排序

http://pat.zju.edu.cn/contests/pat-a-practise/1006#include #include #include using namespace std;struct E{ char no[20]; //编号不超过15位 char stime[10]; //开始结束时间 char

2013-02-19 10:44:13 274

原创 1005. Spell It Right

大意:N例:9999 9999 9  ----->81 ------->eight onehttp://pat.zju.edu.cn/contests/pat-a-practise/1005#include #include char num[10][10]={ {"zero"}, {"one"}, {"two"}, {"three"}, {"four"}, {"

2013-02-19 10:26:03 244

原创 1003. Emergency_dijkstra(带权值)

http://pat.zju.edu.cn/contests/pat-a-practise/10031、看清题意,求最短路径条数而非最短路径长度2、相同最短路径,输出最大救援人数3、本题是结点附带一个权值(救援人数)与边上的权值不同,两种题型的相应处理熟练掌握4、通过本题掌握:                   1、dij求最短路径长度算法(邻接表)

2013-02-18 19:05:40 347

原创 1002A+B for Polynomials

http://pat.zju.edu.cn/contests/pat-a-practise/1002#include #include double coa[1002]; //分别保存两个多项式指数的系数,最多1000次方double cob[1002]; //coa[i] i次方的指数int main(){ int i,x,k; /

2013-02-18 15:43:08 288

原创 1001_求和结果格式化输出

http://pat.zju.edu.cn/contests/pat-a-practise/1001首先明白格式化,从低位到高位,每三位一组,组之间用逗号隔开因此不能按单位输出,按三位输出获得低三位就是求余1000,获得中间三位就是/1000再求余1000例:999+1=1,000       -10000+1=-9,999因此将结果分为,x>=1 000 000,

2013-02-18 12:30:40 286

原创 zju2007EXCEL排序

http://acm.hdu.edu.cn/showproblem.php?pid=1862浙大计算机研究生复试上机考试-2007年 sort函数,O(n*logn)  最大复杂度100000*log100000 也不会超过时间(1s)#include #include //sort()函数#include //strcmp()函数using n

2013-02-18 09:29:56 251

原创 zju2005排名_结构体

http://acm.hdu.edu.cn/showproblem.php?pid=1236浙大计算机研究生复试上机考试-2005年不要使用标记数组,while(x--)写的很巧妙#include #include #include using namespace std;struct E{ char no[30]; //准考证号

2013-02-17 19:30:05 235

原创 zju2005开门人和关门人

http://acm.hdu.edu.cn/showproblem.php?pid=1234浙大计算机研究生复试上机考试-2005年#include #include #include //用到sortusing namespace std; //std必须 struct E //用字符串保存格式

2013-02-17 18:23:00 250

原创 zju2008欧拉回路

欧拉回路:①不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路            ②无向图欧拉判定的充要条件是:1)每个点的度数为偶数,2)图是连通的   http://acm.hdu.edu.cn/showproblem.php?pid=1878浙大计算机研究生复试上机考试-2008年#include #include bool graph[100

2013-02-17 17:27:01 275

原创 zju2008继续畅通工程(村庄已建成)

http://acm.hdu.edu.cn/showproblem.php?pid=1879浙大计算机研究生复试上机考试-2008年#include #include using namespace std;struct Edge{ int a,b; int cost; int tag; //标志是否已建成,ta

2013-02-17 16:49:36 279

原创 zju2007畅通工程(判断连通否)

http://acm.hdu.edu.cn/showproblem.php?pid=1863浙大计算机研究生复试上机考试-2007年#include #include using namespace std;struct Edge{ int a,b; int cost;}edge[5000];int Tree[100];bool cm

2013-02-17 16:12:10 202

原创 zju2005畅通工程_九度66

http://acm.hdu.edu.cn/showproblem.php?pid=1232浙大计算机研究生复试上机考试-2005年熟练掌握并查集解决图连通问题#include int Tree[1000]; //Tree[i]保存i的双亲结点编号int findRoot(int x){ if (Tree[x]==-1)

2013-02-17 15:30:06 284

原创 zju2007游船出租

http://acm.hdu.edu.cn/showproblem.php?pid=1861浙大计算机研究生复试上机考试-2007年#include #include struct Node{ int no; int h,m; int tag;}a[105]; //保存第i号船的时间信息int

2013-02-17 14:38:02 288

原创 zju2006简单计算器

利用数组模拟栈,从左至右遍历算数表达式,遇到乘除则计算结果遇到加减则进栈,最后再按顺序计算加减,得到最终结果浙大计算机研究生复试上机考试-2006年http://acm.hdu.edu.cn/showproblem.php?pid=1237#include typedef struct //运算符和数字轮流保存在数组{

2013-02-17 10:57:34 264

原创 zju2008又一版 A+B

http://acm.hdu.edu.cn/showproblem.php?pid=1877浙大计算机研究生复试上机考试-2008年#include int a[100];int k;void change(int x,int m){ if (x==0) //不要忽略为0的情况 { //注意return 否

2013-02-17 06:59:37 208

原创 zju2006火星A+B

http://acm.hdu.edu.cn/showproblem.php?pid=1230浙大计算机研究生复试上机考试-2006年//http://acm.hdu.edu.cn/showproblem.php?pid=1230#include #include //使用了memset函数int a[30],b[30]; //保存两个输入

2013-02-16 17:32:30 226

原创 zju2006统计同成绩学生人数

http://acm.hdu.edu.cn/showproblem.php?pid=1235浙大计算机研究生复试上机考试-2006年#include int main(){ int n,score[1001],x,i; while (scanf("%d",&n)!=EOF && n!=0) { for (i=0;i<n;i++) { scanf(

2013-02-16 15:26:28 180

原创 zju2007最小长方形

http://acm.hdu.edu.cn/showproblem.php?pid=1859浙大计算机研究生复试上机考试-2007年#include int main(){ int x,y,lx,ly,rx,ry; //定义左下点与右上点 while (scanf("%d%d",&x,&y) && (x||y) ) //注意x,y均

2013-02-16 15:18:20 205

原创 zju2007统计字符串

浙大计算机研究生复试上机考试-2007年http://acm.hdu.edu.cn/showproblem.php?pid=1860 #include #include int main(){ char s1[10]; char s2[100]; int i,j; while (gets(s1)&& strcmp(s1,"#")!=0) //gets(

2013-02-16 14:58:46 195

数据挖掘概念与技术 韩家炜

现在最清晰的一个版本,对于数据挖掘介绍很详细,可以说是入门经典书籍,不多说了,这方面研究生都是人手一本

2013-10-12

高质量编程

如果你想成为一名优秀的程序员,一定要遵循严谨、统一的编程风格,例如命名、代码缩进、错误处理。本书对你绝对非常大的帮助

2013-04-05

电路分析习题解答 高等教育出版社

郑州大学电路分析,高等教育出版社出版的教材,本书是习题解答

2010-12-09

《UNIX操作系统设计》

《UNIX操作系统设计》,机械工业出版社,陈宝玉作品,是学习unix的经典入门翻译作品 pdf 格式

2010-07-26

空空如也

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

TA关注的人

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