print "You enter a dark room with two doors. Do you go through door #1 or door #2?"door = raw_input("> ")if door == "1": print "There's a giant bear ....
分类:
其他好文 时间:
2014-10-24 18:34:08
阅读次数:
242
先看看hashmap在整个Collection中的位置
HashMap中存储数据的结构是
/**
* The table, resized as necessary. Length MUST Always be a power of two.
*/
transient Entry[] table;
上面的英文就不用说了。
原来基础的存储结构式En...
分类:
其他好文 时间:
2014-10-24 14:42:43
阅读次数:
223
sorted(...)
Help on built-in function sorted in module __builtin__:
sorted(...)
sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list
sort(...)
Help on built-in function sor...
分类:
编程语言 时间:
2014-10-24 13:03:18
阅读次数:
202
问题描述:
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
解...
分类:
其他好文 时间:
2014-10-24 13:03:03
阅读次数:
148
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:
其他好文 时间:
2014-10-24 12:44:48
阅读次数:
229
#include #include int main (void){ int password,one,two,money1=1000000,money2=999999,a=0;//a为取的金额 money1为人命币 money2 为美元 printf("请输入您的密码:\n"); scanf("....
分类:
其他好文 时间:
2014-10-24 01:39:39
阅读次数:
161
1. Two Sum(https://oj.leetcode.com/problems/two-sum/)解题思路:解法一: 暴力,O(n2)时间复杂度,TLE解法二:利用hash, 记录下数组中每个值对应的下标,再遍历一遍数组,通过查看target-num[i]的值是否在map中来确定另一个数值。...
分类:
编程语言 时间:
2014-10-24 00:16:44
阅读次数:
226
Language:
Default
Power Strings
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 33205
Accepted: 13804
Description
Given two strings a and b we define a...
分类:
其他好文 时间:
2014-10-23 22:50:27
阅读次数:
198
给n个点,m条边的图,每条边要么属于a公司,要么属于b公司。要求一颗最小生成树,条件是其中属于a公司的边数为k。
这题做法很巧妙。
要求最小生成树,但有一定限制,搜索、贪心显然都不对。
要是能找到一种合理的控制方法,使得求MST的过程中可以控制a公司边的数量,那样问题就解决了。
所以我们可以人为给a公司的边加上一定的权值,使得其中一些边不得不退出MST的选择范围内。
如果此时求的...
分类:
其他好文 时间:
2014-10-23 22:47:26
阅读次数:
339
【题意简述】:这个是别人的博客,有清晰的题意描述,和解题思路,借助他的想法,可以很好的解决这个问题!
【分析】:贪心?模拟?见代码
//216K 16Ms
#include
using namespace std;
int main()
{
int ans,a,b,c,d,e,f,Two,One;// 其中Two表示2*2的个数,同理One表示1*1的个数。
int u[4] = {0...
分类:
其他好文 时间:
2014-10-23 22:46:26
阅读次数:
231