自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 MegStudio新用户邀请码

邀请码:BwssZ新用户填写邀请码可获得200积分哦!(GPU算力通过积分换取)

2021-12-27 15:17:58 403

原创 NLP(0)使用NLTK对英文文本预处理

预处理内容包括:分词去除停用词及标点import nltkfrom nltk.corpus import stopwordsfrom string import punctuation# nltk.download('punkt')S = "The young man is in charge of the company."stoplist = stopwords.words('english')tokens = nltk.word_tokenize(S.lower())pr

2021-04-18 15:55:57 464 1

原创 PIPI1084 最长公共子序列Ⅱ(暴力+set+状压)

题目描述PIPI又来刁难胖虎了~现在PIPI有n个字符串项链,它要你求出这n个环的最长公共子序列,并输出~PS:注意每个字符串都成环了,首尾相连~输入多组数据第一行为一个整数n,1<=n<=10接下来n行,每行一个字符串,保证字符串长度不超过8.输出输出一个字符串,代表n个串的最长公共子序列。若不存在,输出0.若有多个答案,输出字典序最小...

2020-03-31 23:10:46 429

原创 PIPI1091 编程课奖励(滚动数组+dp)

题目描述PIPI老师的Java编程课有N名同学参加了期末考试,现在他们在PIPI老师办公室门外排成一排,领取奖励。PIPI老师决定奖励他们每人若干颗爪哇咖啡豆。具体规则如下:每人奖励至少一颗,最多K颗咖啡豆。对于前后相邻的2名同学,如果他们期末分数一样,那么他们得到的咖啡豆数量也要一样;否则分数高的同学得到较多的咖啡豆。现在按他们排队的顺序给定每名同学的期末考试分数...

2020-03-31 17:13:50 297 2

原创 回文素数(10亿)—— unfinished

靠打表过了1e8 构造+素性测试过一组1e9应该没问题 多组过不了附代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;int table_[781] = {2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727...

2020-01-27 11:05:51 407

原创 哥德巴赫猜想(1e5)

#include <bits/stdc++.h>using namespace std;const int MAXN = 1e5 + 10;bool notprime[MAXN];int n;void init() { memset(notprime, false, sizeof(notprime)); notprime[0] = notprime[1] = true;...

2020-01-21 21:31:50 485

原创 1142 Maximal Clique (25 分)——PAT A

1142Maximal Clique(25分)Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be extend...

2019-09-07 10:25:39 109

原创 1155 Heap Paths (30 分)——PAT A

1155Heap Paths(30分)In computer science, aheapis 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 gre...

2019-09-06 16:18:57 87

原创 1154 Vertex Coloring (25 分)

1154Vertex Coloring(25分)Aproper vertex coloringis a labeling of the graph's vertices with colors such that no two vertices sharing the same edge have the same color. A coloring using at mostk...

2019-09-06 15:36:31 82

原创 1153 Decode Registration Card of PAT (25 分)

1153Decode Registration Card of PAT(25分)A registration card number of PAT consists of 4 parts:the 1st letter represents the test level, namely,Tfor the top level,Afor advance andBfor basi...

2019-09-06 15:10:31 97

原创 1072 Gas Station (30 分)——PAT A

1072Gas Station(30分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must g...

2019-09-05 14:12:32 88

原创 1076 Forwards on Weibo (30 分)——PAT A

1076Forwards on Weibo(30分)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 wi...

2019-09-03 21:09:49 85

原创 1083 List Grades (25 分)——PAT A

1083List Grades(25分)Given a list ofNstudent records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student rec...

2019-09-03 15:34:32 87

原创 1075 PAT Judge (25 分)——PAT A

1075PAT Judge(25分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specificati...

2019-09-03 14:14:35 102

原创 1062 Talent and Virtue (25 分)——PAT A

1062Talent 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 outs...

2019-09-02 20:57:33 88

原创 1055 The World's Richest (25 分)——PAT A

1055The 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, ...

2019-09-02 18:01:07 83

原创 1048 Find Coins (25 分)——PAT A

1048Find 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 coi...

2019-09-02 16:28:53 101

原创 1050 String Subtraction (20 分)——PAT A

1050String Subtraction(20分)Given two stringsS​1​​andS​2​​,S=S​1​​−S​2​​is defined to be the remaining string after taking all the characters inS​2​​fromS​1​​. Your task is simply to calcu...

2019-09-02 16:08:55 81

原创 1092 To Buy or Not to Buy (20 分)——PAT A

1092To Buy or Not to Buy(20分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However th...

2019-09-01 20:12:41 93

原创 1084 Broken Keyboard (20 分)——PAT A

1084Broken Keyboard(20分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a st...

2019-09-01 19:52:45 106

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

1079Total 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.Starti...

2019-08-29 20:21:36 90

原创 1086 Tree Traversals Again (25 分)——PAT A

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

2019-08-28 23:37:04 132

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

1090Highest 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.Star...

2019-08-28 22:17:24 105 1

原创 1094 The Largest Generation (25 分)——PAT A

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

2019-08-28 21:28:17 109

原创 1102 Invert a Binary Tree (25 分)——PAT A

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

2019-08-28 20:51:29 60

原创 1106 Lowest Price in Supply Chain (25 分)——PAT A

1106Lowest 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.Start...

2019-08-28 16:33:04 65

原创 1115 Counting Nodes in a BST——PAT A

1115Counting Nodes in a BST(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 le...

2019-08-27 11:20:05 68

原创 1028 List Sorting (25 分)——PAT A

1028List Sorting(25分)Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, t...

2019-08-26 10:09:15 75

原创 1012 The Best Rank (25 分)——PAT A

1012The Best Rank(25分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only:C- C Programming Language,M- Mathematics (Calculus or L...

2019-08-26 08:08:24 123

原创 1034 Head of a Gang(未解决)——PAT A

1034Head 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 betweenAandB, we say thatAandBis related. The weight of a...

2019-08-25 18:06:48 73

原创 1009 Product of Polynomials (25 分)

1009Product of Polynomials(25分)This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines...

2019-08-25 09:55:44 79

原创 1003 Emergency (25 分)——PAT A

1003Emergency(25分)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...

2019-08-21 15:59:59 115

原创 1002 A+B for Polynomials——PAT A

1002A+B for Polynomials(25分)This time, you are supposed to findA+BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, a...

2019-08-21 14:29:29 81

原创 爬楼梯——动态规划

假设你正在爬楼梯。需要 n阶你才能到达楼顶。每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?注意:给定 n 是一个正整数。示例 1:输入: 2输出: 2解释: 有两种方法可以爬到楼顶。1. 1 阶 + 1 阶2. 2 阶示例 2:输入: 3输出: 3解释: 有三种方法可以爬到楼顶。1. 1 阶 + 1 阶 + 1 阶2. 1 阶...

2019-08-11 17:14:24 204

原创 全排列——递归&&回溯

给定一个没有重复数字的序列,返回其所有可能的全排列。示例:输入: [1,2,3]输出:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/permutations著作权归领扣网络所有。商业转载请...

2019-08-10 23:09:00 146

原创 最长回文子串——字符串处理

给定一个字符串 s,找到 s 中最长的回文子串。你可以假设s 的最大长度为 1000。示例 1:输入: "babad"输出: "bab"注意: "aba" 也是一个有效答案。示例 2:输入: "cbbd"输出: "bb"来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/longest-palindromic-subst...

2019-08-10 21:51:06 158

原创 无重复字符的最长子串——字符串处理

给定一个字符串,请你找出其中不含有重复字符的最长子串的长度。示例1:输入: "abcabcbb"输出: 3解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。示例 2:输入: "bbbbb"输出: 1解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。示例 3:输入: "pwwkew"输出: 3解释: 因为无重复字符的最长子串是"w...

2019-08-10 20:47:22 93

原创 随机选择算法——快排

随机选择算法: 从一组无序的数组中选出第 k 大的数。 利用快速排序中的partition, 每次划分可以得到第p - left + 1大的数 ,等于 k 直接返回;若k < m,说明第 k 大的数在左边,否则在右边。int randPartition(int A[], int left, int right) { int p = (1.0 * r...

2019-07-19 20:31:12 239

原创 快速排序——排序

快速排序: 选定一个用于划分区间的元素(主元),将数组分成两部分,左边值小于或等于主元值,右边值大于主元值。int randPartition(int A[], int left, int right) { int p = (1.0 *rand() / RAND_MAX * (right - left) + left); // #define RAND_MAX 0x7ff...

2019-07-19 20:05:40 66

原创 归并排序——排序

2-路归并: 将数组划分成2个元素一组,组内排好序后归并为一组,往复几次至一组。递归实现const int maxn = 100;void merge(int A[], int L1, int R1, int L2, int R2) { int i = L1, j = L2; int temp[maxn], index = 0; while (i <= R1 ...

2019-07-17 20:41:10 58

空空如也

空空如也

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

TA关注的人

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