自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

大山喵写博客的地方

手撕bug,代码成诗,点点滴滴,便是青春

  • 博客(56)
  • 收藏
  • 关注

原创 1066 Root of AVL Tree (25 分)AVL树

题目An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing...

2018-12-31 15:55:10 585

原创 1065 A+B and C (64bit) (20 分)溢出判定

题目Given three integers A, B and C in [−263,263][−2^{63},2^{63}][−263,263], you are supposed to tell whether A+B>CA+B>CA+B>C.Input Specification:The first line of the input gives th...

2018-12-29 11:30:23 685

原创 1064 Complete Binary Search Tree (30 分)完全二叉搜索树

题目A 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 the node’s key.The right s...

2018-12-28 22:26:52 496

原创 1063 Set Similarity (25 分)求集合交集并集比值

题目Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100N_c/N_t\times 100%Nc​/Nt​×100, where NcN_cNc​ is the number of distinct common numbers shared by the two sets, and N...

2018-12-28 17:54:47 470

原创 1062 Talent and Virtue (25 分)排序(水题)

题目About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and v...

2018-12-28 16:41:27 467

原创 1061 Dating (20 分)字符串的处理

题目Sherlock Holmes received a note with some strange strings: Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange stri...

2018-12-28 11:22:05 594 1

原创 1060 Are They Equal (25 分)字符串转换浮点型数值

题目If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×1050.123×10^50.123×105 with simple chopping. Now given t...

2018-12-27 20:27:03 356 3

原创 厄拉多塞素数筛选法

  厄拉多塞是一位古希腊数学家,他在寻找素数时,采用了一种与众不同的方法——  先将2-N的各数放入表中,然后在2的上面画一个圆圈,然后划去2的其他倍数;第一个既未画圈又没有被划去的数是3,将它画圈,再划去3的其他倍数;现在既未画圈又没有被划去的第一个数 是5,将它画圈,并划去5的其他倍数……依次类推,一直到所有小于或等于N的各数都画了圈或划去为止。这时,表中画了圈的以及未划去的那些数正好就是小...

2018-12-27 15:18:59 1812

原创 1059 Prime Factors (25 分)厄拉多塞素数筛选法

题目Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N=p1k1×p2k2×⋯×pmkmN=p_1^{k_1} \times p_2^{k_2}\times ⋯\times p_m^{k_m}N=p1k1​​×p2k2​​×⋯...

2018-12-27 14:54:56 404

原创 C/C++:long int与long long的区别

long int  long int即long,给人的感觉好像是长整型,但实际上,它和int一样,只有32位。cppreference给出的定义是——int - basic integer type. The keyword int may be omitted if any of the modifiers listed below are used. If no length modif...

2018-12-25 11:07:02 182009 12

原创 1058 A+B in Hogwarts (20 分)混合进制

题目If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a ...

2018-12-24 22:15:25 351

原创 1057 Stack (30 分)树状数组求堆栈中位数

题目Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and...

2018-12-24 22:00:33 681

原创 1056 Mice and Rice (25 分)分组求最大值

题目Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much r...

2018-12-24 20:28:50 1268 3

原创 1055 The World's Richest (25 分)条件排序

题目Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the pe...

2018-12-24 11:24:34 320

原创 1054 The Dominant Color (20 分)哈希表+map的运用

题目Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called th...

2018-12-23 22:40:54 364

原创 1053 Path of Equal Weight (30 分)

题目Given a non-empty tree with root R, and with weight WiW_iWi​ assigned to each tree node TiT_iTi​. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the...

2018-12-23 22:33:14 427

原创 1052 Linked List Sorting (25 分)链表排序

题目A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now g...

2018-12-21 19:14:11 872 4

原创 1051 Pop Sequence (25 分)模拟堆栈

题目Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of ...

2018-12-21 18:00:02 799 3

原创 1050 String Subtraction (20 分)哈希表求字符串差集

题目Given two strings S1S_1S1​ and S2S_2S2​, S=S1−S2S=S_1−S_2S=S1​−S2​​ is defined to be the remaining string after taking all the characters in S2S_2S2​ from S1S_1S1​. Your task is simply to calculate...

2018-12-20 11:02:03 334

原创 1049 Counting Ones (30 分)数学建模——左右数分离

题目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’...

2018-12-20 10:06:24 1877 3

原创 1048 Find Coins (25 分)哈希表+排序

题目Eva 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 payments. Howev...

2018-12-19 18:28:58 586 4

原创 1047 Student List for Course (25 分) vector的运用+统计+排序

题目Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input...

2018-12-19 16:55:51 263 4

原创 1046 Shortest Distance (20 分)循环队列计算最小距离

题目The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file cont...

2018-12-19 11:53:24 1224 2

原创 1045 Favorite Color Stripe (30 分)

题目Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining pa...

2018-12-18 21:54:58 416

原创 1044 Shopping in Mars (25 分)连续子序列分割

题目Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any positi...

2018-12-18 18:58:09 762 1

原创 1043 Is It a Binary Search Tree (25 分)二叉搜索树的先序遍历

题目A 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 the node’s key.The right s...

2018-12-18 14:19:05 506

原创 1042 Shuffling Machine (20 分)模拟洗牌

题目Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamb...

2018-12-17 11:52:44 290

原创 1041 Be Unique (20 分)哈希表

题目Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from[1,104][1,10^4][1,104]. The first ...

2018-12-17 10:26:01 243

原创 error:stray'\243'in program

  该错误代表编译器在编译源文件时遇到了不可识别的非法字符。其值为ascii码值243。这一个值并不在合法的英文字符范围(0~127)范围内,所以一般都是由于误输入造成的。  出现这类问题时,需要根据提示错误的行数,找到对应行,然后重点查找以下几个方面:  1 是否存在汉字。  大多数的C编译器并不识别汉字,所以变量名中不要使用汉字。  2 是否存在汉语标点。  这种情况是最常见的。C...

2018-12-17 10:03:33 3764 1

原创 1040 Longest Symmetric String (25 分)最长回文子串

题目Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence y...

2018-12-17 09:25:32 224

原创 1039 Course List for Student (25 分)哈希表的运用

题目Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who com...

2018-12-16 22:25:42 457

原创 1038 Recover the Smallest Number (30 分)-字符串分段排序

题目Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0...

2018-12-16 14:27:54 366

原创 1037 Magic Coupon (25 分)排序+贪心

题目The 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 of that produc...

2018-12-16 11:03:50 262

原创 MATLAB 求功率谱

功率谱概念  功率谱(power spectrum)是功率谱密度函数的简称。它定义为单位频带内的信号功率,表示信号功率随着频率的变化情况,即信号功率在频域的分布状况。功率谱表示了信号功率随着频率的变化关系。  功率谱常用于功率信号(区别于能量信号)的表述于分析,其曲线一般以频率为横坐标,功率为纵坐标。周期性连续星号x(t)x(t)x(t)的频谱可以表示为离散的非周期序列xnx_nxn​,它的...

2018-12-13 23:00:42 34302 15

原创 MATLAB subplot绘制子图

  有时候需要在一块figure显示多个坐标图,以做对比。MATLAB提供了subplot函数支持这一做法,用法如下——subplot(m,n,p)  subplot提供了一块mxn的区域,p表示第p个子图,其中,第一行第一列是第一个子图,第一行第二列是第二个子图,以此类推。举个例子,使用ICA处理3个信号之后,在一张图中对比3个解混信号——figure;subplot(3,1,1);...

2018-12-13 21:30:13 30383

原创 MATLAB 程序暂停的方法

程序暂停pause直接输入pause指令即可,程序会暂停等待用户按下任意键。暂停固定时间pause(n);暂停n秒钟,MATLAB 在暂停执行时会阻止或隐藏命令提示符,注意,该暂停无法通过键盘打断。暂停开关指令pause('on');pause('off');通过on和off关键字开启或者关闭pause指令。如果pause被关闭,所有的pause指令都会失效。所以可以通过查...

2018-12-13 11:10:06 36674

原创 MATLAB从 添加文件路径到工作空间

添加某个文件或文件夹addpath(‘matlabfile.m’);添加所有文件及文件夹addpath(genpath('.'));其中,genpath是生成文件路径的函数,该路径包括当前路径下所有的文件和子文件夹路径,或者,还可以这样——addpath(genpath(pwd));可以在自己的工程中的根目录写入该语句,使每次打开MATLAB都能把所需的文件加入工作空间。定义搜...

2018-12-13 10:39:42 3733

原创 1036 Boys vs Girls (25 分)排序(水题)

题目This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one ...

2018-12-12 21:13:19 360

原创 1035 Password (20 分)字符串处理(水题)

题目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 ...

2018-12-11 21:32:24 567 2

原创 1034 Head of a Gang (30 分)图的连通分量

题目One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to b...

2018-12-11 20:47:39 1010 2

空空如也

空空如也

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

TA关注的人

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