Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
分类:
其他好文 时间:
2014-12-02 19:08:20
阅读次数:
209
【题目】
Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two endpoints of line i is at (i, ai) and (i,...
分类:
其他好文 时间:
2014-12-02 10:38:56
阅读次数:
170
【题目】
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
【解析】
题意:给定一个字符串数组,返回所有是“换位词”的字符串。
所谓“换位词/变位词”就是包含相同字母,但字母顺序可能不同的字符串。比...
分类:
其他好文 时间:
2014-12-02 10:35:23
阅读次数:
129
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5124题目意思:给出 n 条线段,每条线段用两个整数描述,对于第 i 条线段:xi,yi 表示该条线段的左端点和右端点。设 A 表示最多线段覆盖的点(当然这个 A 可以有多个啦,但这个无关紧要)。现在需要...
分类:
其他好文 时间:
2014-12-01 22:21:31
阅读次数:
156
本次热身赛6道题目,由于没有官方解题报告,自己写了一个山寨版的解题报告,希望对学弟学妹有所帮助
期中两到签到题该校OJ上没有挂出,我在田大神的帮助下a掉了其它四题,解题报告如下所示
线段
Time Limit: 1000 MS
Memory Limit: 32768 K
Total Submit: 10(6 users)...
分类:
其他好文 时间:
2014-12-01 20:59:15
阅读次数:
341
A题:who is the best?
题目地址:HDU 5123
水题。
哈希,然后枚举找最大的,从小的开始找。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;...
分类:
其他好文 时间:
2014-12-01 20:55:53
阅读次数:
295
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki...
分类:
其他好文 时间:
2014-11-30 22:55:07
阅读次数:
272
A题:Fight
the Monster
枚举+二分
因为每个元素的数据范围只有100,所以可以用枚举,对于血量用二分,然后判断结果是否可行。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using...
分类:
其他好文 时间:
2014-11-30 18:47:33
阅读次数:
202
任务是判断可能出现的情况:1.空格2.空指针3.首字符是04.首字符是“+”或“-”5.判断边界条件,上界INT_MAX=2147483647,下届INT_MIN=-2147483648,小心判断 1 // 2 // main.cpp 3 // Longest Substring 4 // ...
分类:
其他好文 时间:
2014-11-30 14:07:58
阅读次数:
163
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112解题报告:扫一遍 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const int ...
分类:
其他好文 时间:
2014-11-30 06:28:09
阅读次数:
214