自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(97)
  • 收藏
  • 关注

原创 screen 使用方法

【代码】screen 使用方法。

2023-03-20 21:48:11 143 1

原创 Python from . import

在上一级文件夹sound下的filters文件夹里的__init__.py程序中导入equalizer子模块。在当前文件夹effects里的__init__.py程序中导入echo子模块。从上一级文件夹sound下的filters文件夹里的__init__.py导入。在上一级文件夹sound里的__init__.py程序中导入formats。

2023-03-16 14:08:48 187

原创 ImportError: cannot import name ‘secure_write‘ or 运行具有“py36-pt15”的单元格需要ipykernel包

ImportError: cannot import name 'secure_write' or 运行具有“py36-pt15”的单元格需要ipykernel包

2023-03-06 18:53:31 968 1

原创 leetcode 9. 回文数

给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。示例 1:输入:x = 121输出:true示例2:输入:x = -121输出:false解释:从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。示例 3:输入:x = 10输出:false解释:从右向左读, 为 01 。因此它不是一个回文数..

2022-04-23 13:27:42 318

原创 1030 Travel Plan (30 分)

欢迎大家关注我的微信公众号(听烟柳),里面不定时更新PAT-A/B程序代码~A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between...

2022-03-03 22:54:40 84

原创 1030 Travel Plan (30 分)

欢迎大家关注我的微信公众号(听烟柳),里面会不定时更新PAT-A/B程序代码~A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/...

2022-03-03 21:58:47 65

原创 1003 Emergency (25 分)

欢迎大家关注我的微信公众号(听烟柳),里面会不定时更新PAT——A/B程序代码As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of...

2022-03-03 20:41:28 60

原创 1076 Forwards on Weibo (30 分)

欢迎大家关注我的公众号,不定期分享PAT-A/B代码~Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a po...

2022-03-02 20:32:05 120

原创 1021 Deepest Root (25 分)

欢迎大家关注我的公众号,里面不定时分享PAT-A/B代码~A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such aroot is calledthe deep...

2022-03-02 19:49:22 93

原创 1013 Battle Over Cities (25 分)

It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other highways to keep the rest of the c

2022-03-02 16:52:33 172

原创 1066 Root of AVL Tree (25 分)

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 is done to restore this property. Figures 1-4 illustrate t

2022-02-27 20:16:38 177

原创 1099 Build A 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 subtree of a node contains only nodes with keys greater th

2022-02-27 19:23:14 234

原创 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 subtree of a node contains only nodes with keys greater th

2022-02-27 18:55:05 269

原创 1094 The Largest Generation (25 分)

A 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 largest population.Input Specification:Each input file contains one test case.

2022-02-26 23:00:06 176

原创 1090 Highest Price in Supply Chain (25 分)

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys products from one's supplier in a pricePa..

2022-02-26 21:48:43 188

原创 1079 Total Sales of Supply Chain (25 分)

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys products from one's supplier in a pricePa..

2022-02-26 21:19:26 66

原创 1053 Path of Equal Weight (30 分)

Given a non-empty tree with rootR, and with weightWi​assigned to each tree nodeTi​. Theweight of a path fromRtoLis defined to be the sum of the weights of all the nodes along the path fromRto any leaf nodeL.Now given any weighted tree, you ar...

2022-02-26 20:35:23 206

原创 1102 Invert a Binary Tree (25 分)

The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it's your turn to prove that YOU CAN invert a binary tree!Input Specifi

2022-02-25 20:18:04 437

原创 1086 Tree Traversals Again (25 分)

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack operations are: push(1); push(2); push(3); pop(); pop(

2022-02-25 19:21:25 446

原创 1020 Tree Traversals (25 分)

Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree.Input Specification:Each inpu

2022-02-25 17:00:04 131

原创 1091 Acute Stroke (30 分)

One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to calculate the volume of the stroke core.Input Specifica

2022-02-25 14:43:37 85

原创 1103 Integer Factorization (30 分)

TheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed to write a program to find theK−Pfactorization ofNfor any positive integersN,KandP.Input Specification:Each input ...

2022-02-24 17:17:13 169

原创 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 integerkeyand aNextpointer to the next structure. Now given a linked list, you are supposed to sort the structures...

2022-02-24 09:19:48 156

原创 1032 Sharing (25 分)

To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,loadingandbeingare stored as showed in Figure 1....

2022-02-23 21:30:10 53

原创 1071 Speech Patterns (25 分)

People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a speaker's identity, which is useful when validating, for exampl

2022-02-20 16:54:30 83

原创 1054 The Dominant Color (20 分)

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 the dominant color. Astrictlydominant color takes more than..

2022-02-20 16:01:39 407

原创 060 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 as0.123×105with simple chopping. Now given the number of significant digits on a machine and two float numbers, you are su..

2022-02-20 11:23:29 153

原创 1063 Set Similarity (25 分)

Given two sets of integers, the similarity of the sets is defined to beNc​/Nt​×100%, whereNc​is the number of distinct common numbers shared by the two sets, andNt​is the total number of distinct numbers in the two sets. Your job is to calculate the s...

2022-02-19 20:02:44 110

原创 1047 Student List for Course (25 分)

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 Specification:Each input file contains one test case. F

2022-02-19 19:26:17 55

原创 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 comes for a query.Input Specification:Each input file cont

2022-02-19 19:00:06 152

原创 1024 Palindromic Number (25 分)

A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.Non-palindromic numbers can be paired with palindromi.

2022-02-13 20:24:18 77

原创 1023 Have Fun with Numbers (20 分)

Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a diffe

2022-02-13 17:21:33 208

原创 1017 A除以B (20 分)

本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。输入格式:输入在一行中依次给出 A 和 B,中间以 1 空格分隔。输出格式:在一行中依次输出 Q 和 R,中间以 1 空格分隔。输入样例:123456789050987654321 7输出样例:17636684150141093474 3代码:#include<iostream>#include&lt.

2022-02-13 16:31:07 510

原创 1059 Prime Factors (25 分)

Given any positive integerN, you are supposed to find all of its prime factors, and write them in the formatN=p1​k1​×p2​k2​×⋯×pm​km​.Input Specification:Each input file contains one test case which gives a positive integerNin the range oflong in...

2022-02-12 21:05:51 217

原创 1078 Hashing (25 分)

The 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 beH(key)=key%TSizewhereTSizeis the maximum size of the hash table. Qua...

2022-02-12 19:49:30 62

原创 1015 Reversible Primes (20 分)

Areversible primein 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 reverse 37 is also a prime.Now given any two positive integersN(<105) an...

2022-02-11 22:48:29 307

原创 1088 Rational Arithmetic (20 分)

For 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 contains one test case, which gives in one line the two rational numbers in

2022-02-11 21:54:10 56

原创 1034 有理数四则运算 (20 分)

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

2022-02-11 21:50:40 64

原创 1081 Rational Sum (20 分)

GivenNrational numbers in the formnumerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integerN(≤100), followed in the next lineNrational numb...

2022-02-11 21:12:40 303

原创 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's in 1, 10, 11, and 12.Input Specification:Each input f

2022-02-10 21:51:15 367

空空如也

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

TA关注的人

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