自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 CF Round #306 Div2 C题(DP好题)

题目链接https://codeforces.com/problemset/problem/550/C简单题目介绍给一个非负整数N,N没有前导0且最多为100位,你可以任意删除其中的数字,但是不能改变顺序,能否组出一个整除8的数,如果可以输出YES,并且输出数字,否则输出NO。思路有两种做法,第一种做法是数学规律,我个人认为不能处理类似的题(没有证明过,有可能可以),故讲解第二种做法DP。1.设DP[i][j],代表到第i位位置(首位为0),MOD8之后能否得到J,能得到J则为true,否则为f

2022-03-15 19:51:24 500

原创 L3-025 那就别担心了 (30分)

下图转自“英式没品笑话百科”的新浪微博 —— 所以无论有没有遇到难题,其实都不用担心。博主将这种逻辑推演称为“逻辑自洽”,即从某个命题出发的所有推理路径都会将结论引导到同一个最终命题(开玩笑的,千万别以为这是真正的逻辑自洽的定义……)。现给定一个更为复杂的逻辑推理图,本题就请你检查从一个给定命题到另一个命题的推理是否是“逻辑自洽”的,以及存在多少种不同的推理路径。例如上图,从“你遇到难题了吗?”到“那就别担心了”就是一种“逻辑自洽”的推理,一共有 3 条不同的推理路径。输入格式:输入首先在一行中给出两

2020-12-03 13:56:06 1867

原创 一个及其简单的打字游戏

大一期末要交个C语言游戏+答辩,先来个小游戏练练手一个简易的打字游戏,难得注释写的很全,就放上来了有错欢迎指出,游戏有爱自取C#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <time.h>#include <conio.h>#include <windows.h>#define MAXN 5//数组的大小#define WIDTH 4

2020-05-11 22:05:45 323

原创 How Many Answers Are Wrong(边带权并查集)

题目链接http://acm.hdu.edu.cn/showproblem.php?pid=3038根据前面的回答判断下一个回答是否矛盾,因为判断下一个回答要根据前面的回答,所以用并查集来记录前面数之间的关系,如果根据前面数的关系不能判断出这组数据的答案,那就把这组数据也加入到并查集里,如果能判断出答案,但是答案错误,那么res++,下面举一个栗子如果我在前面有输入a,c和a,b之间的...

2020-04-30 09:23:11 226

原创 FatMouse's Speed

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Special JudgeProblem DescriptionFatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, y...

2020-04-16 09:49:34 110

原创 免费馅饼

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然...

2020-04-15 09:46:31 263

原创 威威猫系列故事——打地鼠

Problem Description  威威猫最近不务正业,每天沉迷于游戏“打地鼠”。  每当朋友们劝他别太着迷游戏,应该好好工作的时候,他总是说,我是威威猫,猫打老鼠就是我的工作!  无话可说…    我们知道,打地鼠是一款经典小游戏,规则很简单:每隔一个时间段就会从地下冒出一只或多只地鼠,玩游戏的人要做的就是打地鼠。假设:  1、每一个时刻我们只能打一只地鼠,并且打完以后该时刻...

2020-04-14 10:15:25 228

原创 A + B Problem II(大数加法)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 522761 Accepted Submission(s): 99991Problem DescriptionI have a very simple problem for yo...

2020-04-13 16:02:38 152

原创 Humble Numbers(打表)

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4...

2020-04-13 09:19:16 703

原创 搬寝室

Problem Description搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2k件过去就行了.但还是会很累,因为2k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手...

2020-04-12 13:28:41 78

原创 Super Jumping! Jumping! Jumping!

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Ma...

2020-04-11 17:47:48 143

原创 Common Subsequence

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 2 Accepted Submission(s) : 1Problem DescriptionA subsequence of a given sequence is the given...

2020-04-10 20:27:17 146

原创 PAT乙级 1014 福尔摩斯的约会

分析一下题意,首先要注意,每对要比较的字符串长度不一定是相等的,所以要计算字符串长度,并取最小。1、找到前两个字符串中第一对相等的大写字符,用来表示星期几,星期一到星期日应该对应A~G,这也就是第一个if语句。2、同理,第二对相同的大写字符表示钟表,钟表时间类似16进制计数法,数字0~9表示0~9小时,10点用A,11点用B…,所以判断时间可以用if-else-if判断是不是数字和是否在A~N...

2020-04-06 09:11:40 89

原创 PAT乙级 1012 数字分类(测试点8)

测试点8考察的是A2=n1-n2+n3-n4…正好等于0的时候,应该输出0而不是N。解决方法,设一个变量num2,记录下A2读入了几个数,num2为0输出N,否则输出0。C#include <stdio.h>#include <string.h>#pragma warning(disable:4996)int max(int a,int b){ if(a&g...

2020-04-05 12:37:52 383 2

原创 PAT乙级 一元多项式求导

这里就不放题干了,说一下坑点,多项式的系数不重要,主要注意多项式的次数,当次数为0时,直接结束,但是要进行判断,如果在此之前什么都没输出,要输出0 0,如果有输出,就不用输出0 0了,这也就是测试点3,例如,题目的输出样例和输出样例,输入3 4 -5 2 6 1 -2 0,最后一对数-2 0,碰到了0次,直接结束,又因为之前已经输出了12 3 -10 1 6 0,所以不用输出0 0,如果只输入-2...

2020-04-04 17:09:36 100

原创 PAT乙级 1008 数组元素循环右移问题

同样,写给自己,以前只会再开一个数组和暴力右移,这次学到了新的方法,记录一下。有数组123456,要右移两次,可以分成1234和56两块,两块都左右交换,变成4321和65,432165再左右交换即可变成561234(这步可以省略,直接在432165的情况下写两个for,从N-M~N和1~N-M-1输出)。证明(有错欢迎指出)设一个数组总共有N个数,要右移M位,有元素a,且a的下标为i。那...

2020-04-03 09:34:19 99

原创 PAT乙级 1007 素数对猜想(欧拉筛法)

题目链接 https://pintia.cn/problemsets/994805260223102976/problems/994805317546655744让我们定义d​n​为:dn=pn+1−pn,其中pi​​是第i个素数。显然有d​1​​=1,且对于n>1有d​n​​是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。现给定任意正整数N(<10​5​​),请计算...

2020-04-02 08:58:59 250

原创 Molecular Formula

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 60000/30000K (Java/Other)Problem DescriptionYour mission in this problem is to write a computer program that manipulates molecular formulae in ...

2020-03-29 11:56:18 540

原创 骨牌铺方格

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem Description在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:Input输入数据由多行组成,每行包含一个整...

2020-03-28 20:32:30 154

原创 折线分割平面

Problem Description我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。Input输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示折线的数量。Output对于...

2020-03-27 09:27:59 99

原创 DNA Sorting

Problem DescriptionOne measure of unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequenceDAABEC’’, this m...

2020-03-26 15:36:10 99

原创 Spreadsheet

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionIn 1979, Dan Bricklin and Bob Frankston wrote VisiCalc, the first spreadsheet application. It becam...

2020-03-25 11:52:40 263

原创 Tian Ji -- The Horse Racing

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionHere is a famous story in Chinese history.“That was about 2300 years ago. General Tian Ji was a hi...

2020-03-24 09:22:45 165

原创 今年暑假不AC

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem Description“今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%…”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。作...

2020-03-23 15:27:40 123

原创 Number Sequence

Problem DescriptionA 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).InputThe input ...

2020-03-22 14:00:01 227

原创 Fibonacci Again

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2)....

2020-03-21 10:53:55 117

原创 人见人爱A^B

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem Description求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=...

2020-03-20 08:52:31 43

原创 Rightmost Digit

Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionGiven a positive integer N, you should output the most right digit of N^N.InputThe input contains...

2020-03-19 08:51:45 75

原创 最小公倍数

Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70两个正整数m,n中有mn=最大公因数最小公倍数,最大公因数用辗转相除法(欧几里得算法...

2020-03-18 07:58:30 114

原创 Elevator

Problem DescriptionThe 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 08:47:39 125

原创 Sum Problem

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

2020-03-16 10:20:32 90

原创 A Mathematical Curiosity

Problem DescriptionGiven two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a2+b2 +m)/(ab) is an integer.This problem contains multiple test case...

2020-03-15 18:50:16 1157

原创 看看你的编译器是否允许嵌套注释

出自《C陷阱与缺陷》 练习1-1某些C编译器允许嵌套注释。请写一个测试程序,要求:无论是对允许嵌套注释的编译器,还是对不允许嵌套注释的编译器,该程序都能正常通过编译(无错误消息出现),但是这两种情况下程序执行的结果却不相同。答案总共有两种解法,这里我选择了个人感觉好理解的解法C#include <stdio.h>int main(void){ printf("%d\n"...

2020-03-14 18:43:09 215

原创 Prime Ring Problem

Problem DescriptionA 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-14 12:45:42 176 1

原创 Uniform Generator

Problem DescriptionComputer 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-14 12:37:43 194

原创 Digital Roots

Problem DescriptionThe 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 10:03:25 95

原创 Big Number

Problem DescriptionIn 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 09:58:02 83

原创 The Hardest Problem Ever

Problem DescriptionJulius 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 11:04:12 131

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

Problem DescriptionYour task is to Calculate a + b.InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of...

2020-03-12 11:01:11 139 1

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

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

2020-03-11 11:00:37 185

空空如也

空空如也

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

TA关注的人

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