自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Vincent的专栏

天道酬勤 水滴石穿

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

原创 PAT-A 1088. Rational Arithmetic

1088. Rational ArithmeticFor two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file

2016-08-14 17:34:18 318

原创 PAT-A 1078. Hashing

1078. HashingThe task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be “H(

2016-08-14 17:28:14 463

原创 PAT-A 1090. Highest Price in Supply Chain

1090. Highest Price in Supply ChainA supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone involved in moving a product from supplier to customer.Starting from on

2016-08-14 17:20:05 294

原创 PAT-A 1064. Complete Binary Search Tree

1064. Complete Binary Search TreeA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less tha

2016-08-14 10:04:04 365

原创 PAT-A 1009. Product of Polynomials

1009. Product of PolynomialsThis time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each li

2016-08-13 21:06:24 600

原创 PAT-A 1002.A+B for Polynomials

1002. A+B for PolynomialsThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the in

2016-08-13 20:25:48 377

原创 PAT-A 1004.Counting Leaves

1004. Counting LeavesA family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. InputEach input file contains one test case. Each case sta

2016-08-13 18:24:05 498

原创 PAT-A 1094. The Largest Generation

1094. The Largest GenerationA family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the

2016-08-13 17:24:38 327

转载 【python】centos6安装python3

http://www.jianshu.com/p/6199b5c26725

2016-08-13 13:40:27 352

原创 图的邻接表表示及其BFS遍历

图的邻接表表示及其BFS遍历有下面这张图: 假设该图为有向图,边的指向均为小序号指向大序号。那么对该图的BFS遍历如下(假设从序号0的节点开始遍历): 遍历结果应为:a b f c g i d e hBFS遍历类似于树的层序遍历,需要用到队列。下面是程序代码:1.队列定义和相关操作文件1 queue.h//1.queue.h#ifndef QUEUE_H#define QUEUE

2016-08-09 14:11:23 2020

原创 图的邻接表表示及其DFS遍历

图的邻接表表示及其遍历1.图的结构定义#define MAXVEX 100#define true 1typedef char VertexType; //定义图节点值得类型,可随意更换typedef int EdgeType; typedef struct EdgeNode //定义边表节点{ int adjvex;

2016-08-08 17:34:37 937

原创 PAT-A 1024. Palindromic Number

1024. Palindromic NumberA number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers

2016-08-04 11:17:32 273

原创 PAT-A 1019. General Palindromic Number

1019. General Palindromic NumberA number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit

2016-08-03 23:10:00 258

原创 PAT-B 1055. 集体照

1055. 集体照拍集体照时队形很重要,这里对给定的N个人K排的队形设计排队规则如下:每排人数为N/K(向下取整),多出来的人全部站在最后一排;后排所有人的个子都不比前排任何人矮;每排中最高者站中间(中间位置为m/2+1,其中m为该排人数,除法向下取整);每排其他人以中间人为轴,按身高非增序,先右后左交替入队站在中间人的两侧(例如5人身高为190、188、186、175、170,则队形为17

2016-08-03 21:33:07 503

原创 PAT-B 1048. 数字加密

1048. 数字加密本题要求实现一种数字加密方法。首先固定一个加密用正整数A,对任一正整数B,将其每1位数字与A的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对13取余——这里用J代表10、Q代表11、K代表12;对偶数位,用B的数字减去A的数字,若结果为负数,则再加10。这里令个位为第1位。输入格式:输入在一行中依次给出A和B,均为不超过100位的正整数,其间以空格分隔。输出格式:在

2016-08-03 21:29:26 332

原创 PAT-B 1007.素数对猜想

1007. 素数对猜想让我们定义 dnd_n 为:dn=pn+1−pnd_n = p_{n+1} - p_n,其中 pi 是第i个素数。显然有 d1=1 且对于n>1有 dnd_n 是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。现给定任意正整数N(<105)N (< 10^5),请计算不超过N的满足猜想的素数对的个数。输入格式:每个测试输入包含1个测试用例,给出正整数N。输出格式:每

2016-08-03 21:10:03 1247

原创 PAT-A 1048. Find Coins

1048. Find CoinsEva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as pay

2016-08-03 20:42:13 326

原创 PAT-A 1037. Magic Coupon

1037. Magic CouponThe magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value

2016-08-03 20:38:44 260

原创 PAT-A 1099. Build A Binary Search Tree

1099. Build A Binary Search TreeA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than

2016-08-03 20:25:18 362

原创 PAT-A 1085. Perfect Sequence

1085. Perfect SequenceGiven a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m * p where M and m are the maximum and minimum numbe

2016-08-03 20:19:45 325

原创 PAT-A 1081.Rational Sum

1081. Rational SumGiven N rational numbers in the form “numerator/denominator”, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with

2016-08-03 20:15:20 315

原创 PAT-A 1069. The Black Hole of Numbers

1069. The Black Hole of NumbersFor any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new n

2016-08-03 20:12:11 305

原创 PAT-A 1015. Reversible Primes

1015. Reversible PrimesA reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its r

2016-08-03 20:07:39 284

原创 PAT-B 1052.卖个萌

萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的:[左手]([左眼][口][右眼])[右手]现给出可选用的符号集合,请你按用户的要求输出表情。输入格式:输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号[]内。题目保证每个集合都至少有一个.。之后一行给出一个正整数K,为用户请求的个数。随后K行,每行给出一个用户的符号

2016-08-03 12:27:07 348

原创 PAT-B 1034. 有理数四则运算

本题要求编写程序,计算2个有理数的和、差、积、商。输入格式:输入在一行中按照“a1/b1 a2/b2”的格式给出两个分数形式的有理数,其中分子和分母全是整型范围内的整数,负号只可能出现在分子前,分母不为0。输出格式:分别在4行中按照“有理数1 运算符 有理数2 = 结果”的格式顺序输出2个有理数的和、差、积、商。注意输出的每个有理数必须是该有理数的最简形式“k a/b”,其中k是整数部分,a/b是最

2016-08-03 12:25:47 378

原创 PAT-B 1050.螺旋矩阵

题目描述本题要求将给定的N个正整数按非递增的顺序,填入“螺旋矩阵”。所谓“螺旋矩阵”,是指从左上角第1个格子开始,按顺时针螺旋方向填充。要求矩阵的规模为m行n列,满足条件:m*n等于N;m>=n;且m-n取所有可能值中的最小值。输入格式:输入在第1行中给出一个正整数N,第2行给出N个待填充的正整数。所有数字不超过104,相邻数字以空格分隔。输出格式:输出螺旋矩阵。每行n个数字,共m行。相邻数字以1个

2016-08-02 18:06:03 537

原创 【回溯法】游戏竞赛

题目描述某游戏规则中,甲乙双方战斗,每一回合总能分出胜负,游戏规定: 1.失败的一方要将自己体力值的1/4加给胜利的一方。 2.游戏开始时,甲的体力值是1000,乙的体力值是2000。 3.每一回合,甲乙胜利的概率均为50%。 求解4个回合后,双方体力值之差小于1000的概率。分析每一回合结束,要么甲赢,要么乙赢。n个回合,那么有2^n种结果,采用回溯法从解空间中,中找出abs(a-b)<1

2016-08-02 14:15:10 714

原创 【回溯法】求子集问题

????????{1,2,3},?????????? ???????????,????????????,??????,???????? ????????n????????,?????????i,?xi?????????????,xi=1??????,xi=0???????,??,??????: {x1,x2,x3,x4……xn};???2^n?????????????. ????:#in

2016-08-02 10:38:10 8570 13

原创 【回朔法】八皇后问题

八皇后问题,是一个古老而著名的问题,是回溯算法的典型案例。该问题是国际西洋棋棋手马克斯·贝瑟尔于1848年提出:在8×8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 假设八个皇后的位置分别用X1到X8表示,那么Xi可以取的值为1~8,因此,问题的解可以用向量 {x1,x2,x3,x4,x5,x6,x7,x8}表示,解空间包含8

2016-08-02 09:40:56 511

原创 PAt-A 1065. A+B and C(64bit)

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.Input Specification:The first line of the input gives the positive number of test cases, T (<=10). Then T test c

2016-08-01 15:00:09 284

原创 PAT-A 1035. Password

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L i

2016-08-01 14:57:39 319

原创 PAT-A 1049. Counting Ones

The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s in

2016-08-01 13:07:11 612

Automation Studio使用入门手册

贝加莱的PLC使用说明,针对初学者,挺不错的资料

2015-09-24

空空如也

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

TA关注的人

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