- 博客(21)
- 收藏
- 关注
原创 MD5加密
public final static String str2MD5(String inStr) { char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { byte[] strTemp = inStr.getBytes("UTF-8"); ...
2021-03-15 10:50:08
121
原创 判断括号的合理性
给出一个仅包含字符'(',')','{','}','['和']',的字符串,判断给出的字符串是否是合法的括号序列括号必须以正确的顺序关闭,"()"和"()[]{}"都是合法的括号序列,但"(]"和"([)]"不合法。本次题目主要考察了栈的思想,采用假设的方法,如果该字符串是合法的,每一个左括号一定会对应一个右括号,所以在出栈的时候一定是和当前所对应的字符一样。public static boolean isValid(String s){ Stack<Character> sta.
2020-11-07 16:59:47
254
原创 寻找最大的子字符串
给定两个字符串str1和str2,输出两个字符串的最长公共子串,如果最长公共子串为空,输出-1。之前用c语言来实现这道题目的话,首先想到动态规划,但是需要一个字符一个字符的比较,有点麻烦,本次采用java语言来实现这个问题。利用String的字符串中的contains方法来判断是否包含。代码如下啊所示:public class NC127 { public static String LCS (String str1, String str2) { StringBuil
2020-11-07 16:40:14
436
原创 Storage存储范例
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title></title> <script language="JavaScript"> function onLoad() { i
2018-05-19 20:39:42
373
原创 使用文件域用来上传用户照片
<form> <h3 align="center">人口调查</h3> 姓名:<input type="text" name="usename" size="20"></br> 性别:<input ttype="text&quo
2018-05-18 21:04:41
824
原创 G - 一个人的旅行 HDU - 2066
虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的放个假
2017-07-21 21:46:25
293
原创 G - Five-In-a-Row CodeForces - 825B
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.In current match th
2017-07-21 09:35:31
285
原创 D - Meteor Shower POJ - 3669
Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a sa
2017-07-20 19:53:44
263
原创 F - 小希的迷宫 HDU - 1272
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的
2017-07-20 15:54:35
236
原创 E - find the most comfortable road HDU - 1598
XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提速/降速,痛苦呀 ), 但XX星人对时
2017-07-20 15:29:56
194
原创 B - Out of Hay POJ - 2395
The cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other farms to survey their hay situation. There are N (2 <= N <= 2,000) farms (numbered 1
2017-07-20 08:42:17
305
原创 A - Find The Multiple POJ - 1426
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there
2017-07-20 08:20:37
217
原创 Prim 模板
#includeint main(){ int n,m; while(~scanf("%d",&n)&&n) { int i,j,k,min,t1,t2,t3,a[110][110]; int e[110][110],dis[110],book[110]= {0}; int inf=999999999; i
2017-07-17 21:51:55
176
原创 畅通工程
某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个城市之间可以有多条道路相通,也就是说 3 3
2017-07-17 21:32:48
183
原创 I - Dice
There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a 1.a 2,a 3,a 4,a 5,a 6 to be numbers written on top face, bottom face, left face, right fac
2017-07-14 22:01:16
238
原创 木棍
George took sticks of the same length and cut them randomly until all parts became at most 50 unitslong. Now he wants to return sticks to the original state, but he forgot how many sticks he had origi
2017-07-14 21:54:08
394
转载 Bone Collector
Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave … The bone collecto
2017-07-11 14:48:00
274
原创 Doing Homework again HDU - 1789
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after th
2017-07-11 14:39:19
253
原创 心急的C小加
描述C小加有一些木棒,它们的长度和质量都已经知道,需要一个机器处理这些木棒,机器开启的时候需要耗费一个单位的时间,如果第i+1个木棒的重量和长度都大于等于第i个处理的木棒,那么将不会耗费时间,否则需要消耗一个单位的时间。因为急着去约会,C小加想在最短的时间内把木棒处理完,你能告诉他应该怎样做吗?输入第一行是一个整数T(1每组测试数据的第一行是一个整数N(1
2017-05-18 21:58:46
233
原创 蛇形填数
描述在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方陈为:10 11 12 19 16 13 28 15 14 37 6 5 4输入直接输入方陈的维数,即n的值。(n输出输出结果是蛇形方陈。样例输入3样例输出7 8 16 9 25 4 3 #include#includeint book[100
2017-05-03 21:58:26
206
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人