自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 PAT甲级记录

这个适用于我自己总结自己那些题做的不好,不会,便于考前或平时的复习和查阅;1002 1009忘记系数在过程中为0的情况1012 23分,排名细节处理不好1024 回文数处理不好,字符串理解不透彻1037 two point 思想1038 字符串比较1056 模拟,队列,比赛团体人数的判断结束技巧,细节处理1060 模拟,科学计数法,========================...

2020-02-02 20:59:14 121

原创 数据集读入

Dataset类代码实战在配置好环境后from torch.utils.data import Datasetfrom PIL import Imageimport osclass MyData(Dataset): def __init__(self,root_dir,label_dir): self.root_dir = root_dir self.label_dir = label_dir self.path = os.path.jo

2022-03-17 22:28:39 266

原创 配置环境torch

pytorch 可以用pycharm 和jupyter 各有好处GPU 主要是下载cuda对应的包,弄了很长时间,最后不知道是哪一步,最终配置上了gpu官网下的要么很慢,要么根本不是gpu,是cpu,最后在官网上找的比较低版本的cuda,version,audio手动下载,手动安装教程jupyter就更气人了,在anaconda prompt手动安装,能打开,但是一直ln[*],服务器一直连接不上,还有什么runtime错误,网上说应该是版本不匹配,内核和什么 有的搞另外低,所以C:\Users

2022-03-17 22:21:14 449

原创 【无标题】

栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的 min 函数在该栈中,调用 min、push 及 pop 的时间复杂度都是 O(1)。记录当前最小的只要有一个变量,实时更新最小值,但是这题要求动态的得到当前栈中最小值,只要重新定义一个栈2,,当入栈1的时候比栈2的top还小,就入栈2,这样就可以保证栈2的top()是当前最小,top()下面的是全局第二小的...

2022-03-10 19:30:43 140

原创 2021-09-28

声明是告诉编译器有这么一个东西定义是告诉编译器这是个什么东西

2021-09-28 16:01:17 83

原创 1103 Integer Factorizatio

The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K−P factorization of N for any positive...

2020-02-15 21:46:51 172

原创 1095 Cars on Campus

Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you a...

2020-02-13 20:16:16 142

原创 1078 Hashing

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 be H(key)=key%TSiz...

2020-02-06 21:18:54 98

原创 1076 Forwards on Weibo

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

2020-02-05 20:25:04 136

原创 1059 Prime Factors

Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p​1​​​k​1​​​​ ×p​2​​​k​2​​​​ ×⋯×p​m​​​k​m​​​​ .Input Specification:...

2020-02-02 20:44:16 109

原创 1022 Digital Library

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...

2020-01-29 22:32:11 91

原创 1015 Reversible Primes

A 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 reverse 37 is also a pr...

2020-01-29 17:13:54 84

原创 1001 A+B Format && 1002 A+B for Polynomials

1001 A+B FormatCalculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification...

2020-01-27 21:42:40 128

原创 1021 Deepest Root

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 a root ...

2020-01-25 13:49:28 121 3

原创 1147 Heaps

In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (i...

2020-01-23 23:06:19 80

原创 1098 Insertion or Heap Sort

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, ...

2020-01-23 16:27:49 97

原创 1114 Family Property

This time, you are supposed to help us collect the data for family-owned property. Given each person’s family members, and the estate(房产)info under his/her own name, we need to know the size of each f...

2020-01-20 21:57:44 726

原创 1051 Pop Sequence

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 the...

2019-11-21 21:52:50 108

原创 1097 Deduplication on a Linked List

Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or a...

2019-11-21 10:39:18 115

原创 1074 Reversing Linked List

Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4,...

2019-11-20 20:41:22 84

原创 1143 Lowest Common Ancestor

The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively defined as a binary tree which has t...

2019-11-19 20:30:01 150

原创 P3372 【模板】线段树 1

题目描述如题,已知一个数列,你需要进行下面两种操作:1.将某区间每一个数加上x2.求出某区间每一个数的和输入格式第一行包含两个整数N、M,分别表示该数列数字的个数和操作的总个数。第二行包含N个用空格分隔的整数,其中第i个数字表示数列第i项的初始值。接下来M行每行包含3或4个整数,表示一个操作,具体如下:操作1: 格式:1 x y k 含义:将区间[x,y]内每个数加上k操作2: ...

2019-11-18 18:02:52 83

原创 1547:【 例 1】区间和

【题目描述】给定一数列,规定有两种操作,一是修改某个元素,二是求区间的连续和。【输入】输入数据第一行包含两个正整数n,m(n≤100000,m≤500000),以下是m行,每行有三个正整数k,a,b(k=0或1,a,b≤n).k=0时表示将a处数字加上b,k=1时表示询问区间[a,b]内所有数的和。【输出】对于每个询问输出对应的答案。【输入样例】10 200 1 101 1 4...

2019-11-17 19:34:27 521

原创 P3368 【模板】树状数组 2

题目描述如题,已知一个数列,你需要进行下面两种操作:1.将某区间每一个数数加上x2.求出某一个数的值输入格式第一行包含两个整数N、M,分别表示该数列数字的个数和操作的总个数。第二行包含N个用空格分隔的整数,其中第i个数字表示数列第i项的初始值。接下来M行每行包含2或4个整数,表示一个操作,具体如下:操作1: 格式:1 x y k 含义:将区间[x,y]内每个数加上k操作2: 格式...

2019-11-14 21:21:54 129

原创 P3374 【模板】树状数组 1

题目描述如题,已知一个数列,你需要进行下面两种操作:1.将某一个数加上x2.求出某区间每一个数的和输入格式第一行包含两个整数N、M,分别表示该数列数字的个数和操作的总个数。第二行包含N个用空格分隔的整数,其中第i个数字表示数列第i项的初始值。接下来M行每行包含3个整数,表示一个操作,具体如下:操作1: 格式:1 x k 含义:将第x个数加上k操作2: 格式:2 x y 含义:输出...

2019-11-14 17:09:42 107

原创 1542:【例 2】最敏捷的机器人

【题目描述】Wind 设计了很多机器人。但是它们都认为自己是最强的,于是,一场比赛开始了……机器人们都想知道谁是最敏捷的,于是它们进行了如下一个比赛。首先,他们面前会有一排共 n 个数,它们比赛看谁能最先把每连续 k 个数中最大和最小值写下来,当然,这些机器人运算速度都很快,它们比赛的是谁写得快。但是 Wind 也想知道答案,你能帮助他吗?【输入】第一行为 n,k,意义如题目描述。第二...

2019-11-14 11:49:24 830

原创 1541:【例 1】数列区间最大值

【题目描述】输入一串数字,给你 M 个询问,每次询问就给你两个数字 X,Y,要求你说出 X 到 Y 这段区间内的最大数。【输入】第一行两个整数 N,M 表示数字的个数和要询问的次数;接下来一行为 N 个数;接下来 M 行,每行都有两个整数 X,Y。【输出】输出共 M 行,每行输出一个数。【输入样例】10 23 2 4 5 6 8 1 2 9 71 43 8【输出样例】5...

2019-11-13 21:26:53 1178

原创 1115 Counting Nodes in a BST

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 or equal to the node’s key.Th...

2019-11-12 18:56:23 112

原创 1127 ZigZagging on a Tree

Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple stand...

2019-11-12 17:28:42 107

原创 1130 Infix Expression

Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operators.Input Specification:Each input file contains...

2019-11-11 21:25:08 79

原创 1123 Is It a Complete AVL Tree

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

2019-11-11 20:13:56 80

原创 1110 Complete Binary Tree

Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (≤20) whic...

2019-11-11 18:06:54 82

原创 1066 Root of AVL Tree

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

2019-11-10 14:58:39 72

原创 1099 Build A Binary Search Tree

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 subt...

2019-11-09 19:18:32 66

原创 1064 Complete Binary Search Tree

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 subt...

2019-11-07 18:37:27 161 1

原创 1043 Is It a Binary Search Tree

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 subt...

2019-11-07 17:38:47 70

原创 1053 Path of Equal Weight

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

2019-11-07 10:05:22 78

原创 1004 Counting Leaves

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts w...

2019-11-03 18:20:43 76

原创 1106 Lowest Price in Supply Chain

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

2019-11-03 17:57:48 147 1

原创 1094 The Largest Generation

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 S...

2019-11-03 16:51:54 69

空空如也

空空如也

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

TA关注的人

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