- 博客(12)
- 收藏
- 关注
原创 Alphabet Animals
Alphabet Animals 来源:Kattis - alphabetanimals 考查 简单的字符串处理 难度 简单 题意理解 给定一个字符串s和一个字符串集合t,遍历集合t,若t中不存在以s最后一个字符开头的字符串,输出’?’;若t中存在以s最后一个字符开头的字符串,设该字符串为s1,且不存在以s1最后一个字符开头的字符串,则输出第一个满足该条件的字符串s1加一个’!’;若t中存在以s最后一个字符开头的字符串,设该字符串为s1,且对于每一个满足条件的s1,t中都存在以s1最后一个字符开头的字符串
2021-09-02 10:58:02
246
原创 Dungeon Master
Dungeon Master 来源:POJ 2251 考查 BFS 难度 简单 题意理解 在一个三维的空间中,输入三个数,分别是L,R,C,代表有L个平面,R行,C列。输入的三维空间中,’.‘代表可以走,’#'代表不能走,'S’代表起点,'E’代表终点。问从起点到终点最少需要多少步,如果不能到达,输出"Trapped!"。 模型建立 三维的BFS 解题思路 建立一个结构体Point,存储每一个位置的信息,有四个成员,分别是三个方向的坐标和走了多少步。开一个三维的数组,在输入时进行初始化,如果输入的点为起点或
2021-08-05 19:50:14
217
原创 Buried memory
Buried memory 来源:HDU - 3007 题目描述: Each person had do something foolish along with his or her growth.But,when he or she did this that time,they could not predict that this thing is a mistake and they will want this thing would rather not happened. The wo
2021-03-14 21:59:44
190
原创 Use of Hospital Facilities
Use of Hospital Facilities 来源:UVA - 212 题目描述: County General Hospital is trying to chart its course through the troubled waters of the economy and shifting population demographics. To support the planning requirements of the hospital, you have been asked
2021-02-08 12:40:39
238
原创 Revenge of Fibonacci
Revenge of Fibonacci 来源:UVA - 12333 题目描述: The well-known Fibonacci sequence is defined as following: F(0) = F(1) = 1 F(n) = F(n − 1) + F(n − 2) ∀n ≥ 2 Here we regard n as the index of the Fibonacci number F(n). This sequence has been studied since the p
2021-01-31 12:58:14
178
原创 Asterism (Easy Version)
Asterism (Easy Version) 来源:CodeForces - 1371E1 题目描述: This is the easy version of the problem. The difference between versions is the constraints on n and ai. You can make hacks only if all versions of the problem are solved. First, Aoi came up with the
2021-01-19 16:19:55
303
原创 Grid-00100
Grid-00100 来源:CodeForces - 1371D 题目描述: A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it! You are given integers n,k. Construct a grid A with size n×n consisting of integers 0 and 1. The very important condition should be
2021-01-19 13:36:21
147
原创 Game On Leaves
Game On Leaves 来源:CodeForces - 1363C 题目描述: Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns: Select any leaf node in the tree and remove it together with any edge which has
2021-01-10 17:33:28
121
原创 Subsequence Hate
Subsequence Hate 来源:CodeForces - 1363B 题目描述: Shubham has a binary string s. A binary string is a string containing only characters “0” and “1”. He can perform the following operation on the string any amount of times: Select an index of the string, and f
2021-01-10 11:58:12
280
原创 判断回文
判断回文 编码实现:输入一个字符串,判断该字符串是否是回文(回文是指将该字符串含有的字符逆序排列后得到的字符串和原字符串相同的字符串)如果是回文,则输出“Yes”;否则输出“No”。 输入格式: 判定是否是回文的字符串 输出格式: “Yes”或者“No” 输入样例: 在这里给出一组输入。例如: TooooT 输出样例: 在这里给出相应的输出。例如: Yes 思路: 读入字符串,然后从字符串的两边对字符串的字符进行比对,看是否满足回文的要求。 AC代码: import java.util.Sc
2020-12-24 22:14:43
811
原创 十进制转二进制
十进制转二进制 编写代码,要求:输入参数是一个正整数,输出该整数所对应的二进制数对应的字符串。 输入格式: 正整数 输出格式: 输入的正整数对应的二进制字符串“1001” 输入样例: 在这里给出一组输入。例如: 9 输出样例: 在这里给出相应的输出。例如: 1001 思路: 除二取余的思想,把余数存进一个数组里,然后倒着输出即可。 AC代码: import java.util.Scanner; public class Main { public static void main(
2020-12-23 22:16:56
407
原创 一个整数各个位上的最大数字
一个整数各个位上的最大数字 编写一个类的方法,其输入参数为一个整数,输出为该整数各个位上的最大数字。 输入格式: 输入一个整数N 输出格式: 输出该整数N各个位上的最大数字 输入样例: 在这里给出一组输入。例如: 59274 输出样例: 在这里给出相应的输出。例如: 9 思路: 输入一个数字,然后对数字进行分割,取出最大的输出即可 AC代码: import java.util.Scanner; public class Main { public static void main(Str
2020-12-20 22:17:48
2165
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅