自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

不知道是些什么东西

在成为学霸的路上爬啊爬~

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

原创 【Leetcode】7. 整数反转(python版本)

题目:链接:https://leetcode-cn.com/problems/reverse-integer//给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。示例1输入: 123输出: 321示例2输入: -123输出: -321示例3输入: 120输出: 21注意假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为 [−2^31, 2^31 − 1]。请根据这个假设,如果反转后整数溢出那么就返回 0。代码:class Sol

2020-10-14 19:46:32 189 1

原创 【Leetcode】6. Z 字形变换(python版本)【单list】

题目:链接:https://leetcode-cn.com/problems/zigzag-conversion/将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。比如输入字符串为 “LEETCODEISHIRING” 行数为 3 时,排列如下:L   C   I   RE T  O  E  S  I  I  GE   D   H    N之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:“LCIRETOESIIGEDHN”。请你实现这个将字符串进行指

2020-10-14 19:43:14 155

原创 【Leetcode】5. 最长回文子串(python版本)

题目:链接:https://leetcode-cn.com/problems/longest-palindromic-substring/给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。示例1输入: “babad”输出: “bab”注意: “aba” 也是一个有效答案。示例2输入: “cbbd”输出: “bb”示例3输入:nums1 = [0,0], nums2 = [0,0]输出:0.00000代码:class Solutio

2020-10-14 19:21:44 157

原创 【Leetcode】4. 寻找两个正序数组的中位数(python版本)

题目:链接:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。请你找出并返回这两个正序数组的中位数。进阶:你能设计一个时间复杂度为 O(log (m+n)) 的算法解决此问题吗?示例1输入:nums1 = [1,3], nums2 = [2]输出:2.00000解释:合并数组 = [1,2,3] ,中位数 2示例2输入:nums1 =

2020-10-12 21:38:37 742 3

原创 【Leetcode】3. 无重复字符的最长子串(python版本)【滑动窗口】

题目:链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。示例1输入: “abcabcbb”输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例2输入: “bbbbb”输出: 1解释: 因为无重复字符的最长子串是 “b”,所以其长度为 1。示例3输入: “pwwkew”

2020-10-12 02:59:05 280

原创 【Leetcode】2.两数相加(python版本)

题目:链接:https://leetcode-cn.com/problems/add-two-numbers/给出两个非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照逆序的方式存储的,并且它们的每个节点只能存储一位数字。如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。您可以假设除了数字 0 之外,这两个数都不会以 0 开头。示例输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)输出:7 -> 0 -> 8原因

2020-10-12 01:07:06 91

原创 【Leetcode】1.两数之和(python版本)——记录我踩过的坑

[Leetcode]1.两数之和(python版本)——记录我踩过的坑题目:解题过程:Ver1.0(WA)Ver2.0(WA)Ver3.0(AC)总结题目:链接:https://leetcode-cn.com/problems/two-sum给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。示例给定 nums = [2, 7, 11, 15], ta

2020-10-11 23:07:33 147

原创 【PAT (Basic Level) Practice (中文)1003】我要通过!

“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串; 如果 a...

2019-01-22 00:12:16 397

原创 【NOJ1048】计算矩阵连乘积【区间dp】

计算矩阵连乘积时限:1000ms 内存限制:10000K  总时限:3000ms描述在科学计算中经常要计算矩阵的乘积。矩阵A和B可乘的条件是矩阵A的列数等于矩阵B的行数。若A是一个p×q的矩阵,B是一个q×r的矩阵,则其乘积C=AB是一个p×r的矩阵。计算C=AB总共需要p×q×r次乘法。现在的问题是,给定n个矩阵{A1,A2,…,An}。其中Ai与Ai+1是可乘的,i=1,2,…,...

2018-11-01 17:28:19 645

原创 【NOJ1044】独轮车【广搜】

1044.独轮车时限:1000ms 内存限制:10000K  总时限:3000ms描述独轮车的轮子上有红、黄、蓝、白、绿(依顺时针序)5种颜色,在一个如下图所示的20*20的迷宫内每走一个格子,轮子上的颜色变化一次。独轮车只能向前推或在原地转向。每走一格或原地转向90度均消耗一个单位时间。现给定一个起点(S)和一个终点(T),求独轮车以轮子上的指定颜色到达终点所需的最短时间。 ...

2018-10-13 20:20:21 355

原创 【poj3069】【贪心】Saruman's Army

题目链接:http://poj.org/problem?id=3069Saruman's ArmyTime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14371   Accepted: 7215 DescriptionSaruman the White must lead his ar...

2018-09-09 23:59:37 160

原创 【HDU6228】【2017ACM/ICPC亚洲区沈阳站】Tree

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6228                                      Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission...

2018-08-30 23:13:57 268 1

原创 【HDU 3586】Information Disturbing【树型DP】

Information DisturbingTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 4528    Accepted Submission(s): 1524 Problem DescriptionIn the ba...

2018-08-16 16:15:39 157

原创 一、Z - A + B Problem II

Z - A + B Problem IIHDU - 1002 I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integ...

2018-08-10 10:52:18 158

原创 一、Y - A == B ?

Y - A == B ?HDU - 2054 Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test case contains two numbers A and B.Outputfor each case, if...

2018-08-10 10:41:32 372

原创 一、X - Specialized Four-Digit Numbers

X - Specialized Four-Digit NumbersPOJ - 2196 Find and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when repr...

2018-08-10 10:30:17 205

原创 一、W - The Circumference of the Circle

W - The Circumference of the CirclePOJ - 2242 To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't?You are given the cartes...

2018-08-10 10:21:25 211

原创 一、V - The Fun Number System

V - The Fun Number SystemPOJ - 1023 In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight of the most significant bit (i.e., in position k-1), is -2^(k-1), and th...

2018-08-10 09:53:35 236

原创 一、U - Long Distance Racing

U - Long Distance RacingPOJ - 3672 Bessie is training for her next race by running on a path that includes hills so that she will be prepared for any terrain. She has planned a straight path and ...

2018-08-10 09:12:08 190

原创 一、S - Counterfeit Dollar

S - Counterfeit DollarPOJ - 1013 Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size...

2018-08-09 09:02:07 421

原创 一、R - Joseph

R - JosephPOJ - 1012 The Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mt...

2018-08-08 11:32:43 315

原创 一、Q - 高精度(大数)n次方

Q - 高精度(大数)n次方POJ - 1001 Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experie...

2018-08-08 11:25:28 1436

原创 一、P - Reduced ID Numbers

P - Reduced ID NumbersPOJ - 2769 T. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0...

2018-08-08 11:16:57 259

原创 一、O - Dirichlet's Theorem on Arithmetic Progressions

O - Dirichlet's Theorem on Arithmetic ProgressionsPOJ - 3006 If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2...

2018-08-08 11:10:52 124

原创 一、N - Bullseye

N - BullseyePOJ - 2272 A simple dartboard consists of a flat, circular piece of cork with concentric rings drawn on it. Darts are thrown at the board by players in an attempt to hit the center of...

2018-08-08 10:07:43 259

原创 一、M - 枚举答案能不能做?

M - 枚举答案能不能做?HDU - 1013 The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the ...

2018-08-07 17:32:58 161

原创 一、L - Delta-wave

L - Delta-waveHDU - 1030 A triangle field is numbered with successive integers in the way shown on the picture below.The traveller needs to go from the cell with number M to the cell with nu...

2018-08-07 17:24:42 519

原创 一、K - next_permutation

K - next_permutationHDU - 1027 Now our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has to beat ...

2018-08-07 14:26:32 192

原创 一、J - Ignatius and the Princess IV

J - Ignatius and the Princess IVHDU - 1029 "OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will ...

2018-08-07 11:17:10 81

原创 一、I - 辗转相除法求最大公约数 HDU - 1019

I - 辗转相除法求最大公约数HDU - 1019 The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5...

2018-08-06 22:14:50 129

原创 一、G - 请使用sort

G - 请使用sortHDU - 1225 Football is one of the greatest games in the world. Lots of people like to play football. After one season of matches, the header has to calculate the last scores of every te...

2018-08-06 19:38:13 213

原创 一、F - Robot Motion

F - Robot MotionHDU - 1035 A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instr...

2018-08-06 19:23:22 140

原创 一、E - A + B

E - A + BHDU - 1228 读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出.Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出.Output对每个测试用例输出1行,即A+B的值.Sample Inpu...

2018-08-06 18:53:00 441

原创 一、D - 不容易系列之(3)―― LELE的RPG难题

D - 不容易系列之(3)―― LELE的RPG难题HDU - 2045 人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即"可乐"),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的...

2018-08-06 14:29:52 143

原创 一、C - Edge

C - EdgeHDU - 1033 For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assum...

2018-08-06 14:26:36 627

原创 一、B - Candy Sharing Game

B - Candy Sharing GameHDU - 1034 A number of students sit in a circle facing their teacher in the center. Each student initially has an even number of pieces of candy. When the teacher blows a whi...

2018-08-06 11:25:52 169

原创 一、A - The 3n + 1 problem

A - The 3n + 1 problemHDU - 1032 Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyz...

2018-08-06 10:26:46 91

原创 T - Switch Game

There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the con

2018-01-31 18:00:03 172

原创 S - Picture

Give you the width and height of the rectangle,darw it. InputInput contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the recta

2018-01-28 22:07:12 189

原创 R - Bitset

Give you a number on base ten,you should output it on base two.(0 InputFor each case there is a postive number n on base ten, end of file.OutputFor each case output a number on base two.将十进制数转化成二进

2018-01-28 20:01:00 201

空空如也

空空如也

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

TA关注的人

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