题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5249
分析:这道题是2015百度之星初赛1的4题
这道题不算太难当时队友做出来了,不过费了老大劲,其实我从中能够吸取教训的,
原因是,我一看这道题就是数据结构的,然后和队友想的一样二分查找,但是从中
遇到了一系列的问题:
首先储存数据我们不能用带有下标的数组,因为题目中的数据是可删可添的这样...
分类:
其他 时间:
2015-06-02 09:29:26
收藏:
0 评论:
0 赞:
0 阅读:
149
题目大意:要求你填一个含有m个字符的字符串,每个位只能填a-z,A-Z
有两条规则:
1.相邻两个字符的ascii差不能超过32
2.相邻的字符中至少存在一个ascii差为32的解题思路:用所有情况 - 不满足的情况
矩阵表示的话,初始矩阵是1行52列的,每一列表示以某个字符结尾的数量有多少个,变化的矩阵是就可以相应推出了。具体看下代码,B表示变化矩阵#include
typ...
分类:
其他 时间:
2015-06-02 09:28:46
收藏:
0 评论:
0 赞:
0 阅读:
113
题意:
给出一颗有根树,边权均为1;
一个S在根结点上,要找到在某个叶子结点上的它的房子;
有的结点上有w,可以告诉S当前结点的子树上是否有它的房子;
房子在每个叶子结点的概率相等,选择一种最佳的计划,来让S走的期望值最小;...
分类:
其他 时间:
2015-06-02 09:28:36
收藏:
0 评论:
0 赞:
0 阅读:
134
如果单单要做出更改一个div的颜色宽高,javascript的实现会很简单,但是写完后,会不会发现写了三个十分相似的函数,对,我们要合并它,尽量减少代码的冗余,也方便以后的修改,让你的代码更灵活。
下面我们看两种属性的赋值方法。
(1)odiv.style.background="green";
(2)odiv.style['background'}="green";
...
分类:
其他 时间:
2015-06-02 09:28:26
收藏:
0 评论:
0 赞:
0 阅读:
226
转载请注明出处:http://blog.csdn.net/ZhouLi_CSDN/article/details/46316855很久没写算法了,今天突然想写一下大数阶乘运算,花了一个多小时写了一个demo,具体算法时间空间复杂度优化并没有考虑,有兴趣可以自己研究一下。
什么都不用说了附上代码:
public class BigNumber { public static void main...
分类:
其他 时间:
2015-06-02 09:28:16
收藏:
0 评论:
0 赞:
0 阅读:
241
串(String)又称字符串,是一种特殊的线性表,表中的元素是单个字符,串是由n个字符组成的有限序列。
S="c1c2c3c4...cn"............(n>=0)
本文实现了串的初始化,串长度的计算,求子串,插入、删除、加法、找位置以及串的输出等函数。
String.h
#ifndef STRING_H_
#define STRING_H_
#include
class St...
分类:
其他 时间:
2015-06-02 09:28:06
收藏:
0 评论:
0 赞:
0 阅读:
141
//数x小于等于b大于0的任意一个数,数y为小于等于d大于0的任意一个
//问有多少对x,y使得gcd(x,y) = k ;
//且(x,y),(y,x)算一对
//可以转化为[1, b/k]中的x , 和 [1,d/k]中的y,
//使得gcd(x,y) = 1
//可以枚举x , 在[1,d/k] 的范围内找大于x,且与x互质的数有多少个
//记录所有x的素数因子
//容斥原理...
分类:
其他 时间:
2015-06-02 09:27:46
收藏:
0 评论:
0 赞:
0 阅读:
109
Spider类定义了如何爬取某个网站。包括爬取的动作以及如何从网页的内容中提取结构化数据。
Spider就是定义爬取的动作及分析某个网页的地方。爬取的循环:①以初始的URL初始化Request,并设置回调函数。当该request下载完毕并返回时,将生成response,并作为参数传给该回调函数。
spider中初始的request是通过调用start_requests()来获取的。start_r...
分类:
其他 时间:
2015-06-02 09:26:56
收藏:
0 评论:
0 赞:
0 阅读:
213
数据可视化分为:科学可视化、信息可视化,可视化分析学这三个主要分支。
科学可视化,处理科学数据,面向科学和工程领域的科学可视化,研究带有空间坐标和几何信息的三维空间测量数据、计算模拟数据和医疗影像数据等,重点探索如何有效地呈现数据中几何、拓扑和形状特征。信息可视化,处理对象是非结构化、非几何的抽象数据,如金融交易、社交网络和文本数据,其核心挑战是如何针对大尺度高维数据减少视觉混淆对有用信...
分类:
其他 时间:
2015-06-02 09:26:47
收藏:
0 评论:
0 赞:
0 阅读:
259
map...
分类:
其他 时间:
2015-06-02 09:26:26
收藏:
0 评论:
0 赞:
0 阅读:
154
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14
= 28, which means...
分类:
其他 时间:
2015-06-02 09:26:16
收藏:
0 评论:
0 赞:
1 阅读:
311
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or
alphabetically, we...
分类:
其他 时间:
2015-06-02 09:26:06
收藏:
0 评论:
0 赞:
0 阅读:
161
基于域名添加虚拟主机 (本例子的域名为 www.shop.com)
第一步:
进入apache\conf目录里,打开httpd.conf文件。
第二步:
找到配置项
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
第三步:
开启该虚拟主机的配置项并写上注释
# 启用虚拟主机文件
# Virtual hosts
Inc...
分类:
其他 时间:
2015-06-02 09:25:36
收藏:
0 评论:
0 赞:
0 阅读:
224
Balloon Comes!
气球来了!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 22727 Accepted Submission(s): 8577
Problem Description
The con...
分类:
其他 时间:
2015-06-02 09:25:26
收藏:
0 评论:
0 赞:
0 阅读:
229
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using...
分类:
其他 时间:
2015-06-02 09:25:06
收藏:
0 评论:
0 赞:
0 阅读:
80
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case...
分类:
其他 时间:
2015-06-02 09:24:56
收藏:
0 评论:
0 赞:
0 阅读:
119
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For ...
分类:
其他 时间:
2015-06-02 09:24:26
收藏:
0 评论:
0 赞:
0 阅读:
163
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n))
代码如下:
class Solutio...
分类:
其他 时间:
2015-06-02 09:24:06
收藏:
0 评论:
0 赞:
0 阅读:
166
Determine whether an integer is a palindrome. Do this without extra space.
本题是判断一个数是否是回文数。
代码如下:
bool isPalindrome(int x) {
int max = x;
int min = 0;
while(max >0){
...
分类:
其他 时间:
2015-06-02 09:23:36
收藏:
0 评论:
0 赞:
0 阅读:
79
这道题我wa了4次!!!RE了一次,直到看到了RE我才看到了希望,果然,把数组开大一点就过了,小白
在uva上的题好像叙述都不太精确,从来都不说数据最长多少,以至于只能瞎开数组,白白RE了一次,wa的原因是因
为数据类型错了,应该开long long的,我竟然忘了商也可以是大数的,,,唉,还是不够细心,不够认真啊。
贴代码:
#include
#include
#include
#defi...
分类:
其他 时间:
2015-06-02 09:23:16
收藏:
0 评论:
0 赞:
0 阅读:
120