自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 马拉车

Manachar算法主要是处理字符串中关于回文串的问题的,它可以在 O(n) 的时间处理出以字符串中每一个字符为中心的回文串半径奇字符串和偶字符串找字串中心符的方式不同(偶是两个字符的中间,奇是中间的字符)查找时要分别讨论,比较由于将原字符串处理成两倍长度的新串,在每两个字符之间加入一个特定的特殊字符,因此原本长度为偶数的回文串就成了以中间特殊字符为中心的奇数长度的回文串了。Manacher算法提供了一种巧妙的办法,将长度为奇数的回文串和长度为偶数的回文串一起考虑,具体做法是,在原字符串的每个相邻两个字

2020-08-10 14:59:32 129

原创 递归求简单交错幂级数的部分和

本题要求实现一个函数,计算下列简单交错幂级数的部分和:f(x,n)=x−x​2​​+x​3​​−x​4​​+⋯+(−1)​n−1​​x​n​​函数接口定义:double fn( double x, int n );其中题目保证传入的n是正整数,并且输入输出都在双精度范围内。函数fn应返回上述级数的部分和。建议尝试用递归实现。#include <stdio.h>double fn( double x, int n );int main(){ double x;

2020-06-20 15:57:13 368

原创 今年暑假不AC(贪心算法)

Problem Description “今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%…”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、超级女生,以及王小...

2020-03-23 22:01:18 202

原创 Number Sequence

Problem Description A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).Input The input ...

2020-03-22 16:13:43 208 1

原创 Fibonacci Again

Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).Input Input consists of a sequence of lines, each containing an integer n. (n &l...

2020-03-21 19:00:04 95

原创 人见人爱A^B

Problem Description 求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。Output 对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。Sample Input2 3...

2020-03-20 09:23:54 82

原创 Rightmost Digit(快速幂)

Problem Description Given a positive integer N, you should output the most right digit of N^N.Input The input contains several test cases. The first line of the input is a single integer T which is t...

2020-03-19 16:56:17 397

原创 最小公倍数

Problem Description 给定两个正整数,计算这两个数的最小公倍数。Input 输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output 对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input 10 14Sample Output 70Source POJ#include <stdio.h>int ...

2020-03-18 12:00:09 144

原创 Elevator

Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified o...

2020-03-17 11:21:59 201

原创 Sum Problem

Problem Description Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + … + n.Input The input will consist of a series of in...

2020-03-16 10:36:53 87

原创 Uniform Generator

Problem Description Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere ‘%’ is the modul...

2020-03-15 20:23:02 138

原创 Prime Ring Problem(dfs)

Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Not...

2020-03-15 20:19:16 120

原创 Digital Roots

Problem Description 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 resulting...

2020-03-13 17:49:41 75

原创 Big Number

Problem Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are g...

2020-03-13 15:28:35 58

原创 The Hardest Problem Ever

Problem Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of th...

2020-03-12 15:43:15 222

原创 A+B for Input-Output Practice (VII)

Total Submission(s) : 36 Accepted Submission(s) : 26Problem Description Your task is to Calculate a + b.Input The input will consist of a series of pairs of integers a and b, separated by a space,...

2020-03-12 15:19:29 32748 1

原创 A+B for Input-Output Practice (VI)

Problem Description Your task is to calculate the sum of some integers.Input Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow ...

2020-03-11 17:06:30 169

原创 A+B for Input-Output Practice (V)

Problem Description Your task is to calculate the sum of some integers.Input Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M inte...

2020-03-11 16:31:36 147

原创 A+B for Input-Output Practice (IV)

Problem Description Your task is to Calculate the sum of some integers.Input Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A te...

2020-03-10 19:10:18 124 1

原创 A+B for Input-Output Practice (III)

Problem Description Your task is to Calculate a + b.Input Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing...

2020-03-10 19:08:22 129

原创 A+B for Input-Output Practice (II)

Problem Description Your task is to Calculate a + b.Input Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a spac...

2020-03-09 20:25:02 126

原创 A+B for Input-Output Practice (I)

Problem Description Your task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners.You must have found that some problems have the same titles with this one...

2020-03-09 20:12:53 422

空空如也

空空如也

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

TA关注的人

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