由买买提看人间百态

topics

全部话题 - 话题: n2
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
p****m
发帖数: 438
1
Get a FREE Brainwavz M2 with the purchase of a Nationite N2 8GB MP3 Player
at Amazon.
N2就是MP4nation贴牌的酷比C30 BBE版,能放flac,MicroSD扩展支持32GB。
M2也是贴牌的维尚RO3银线版。
这两个加起来价钱($85)和从国内买差不多。
D*******l
发帖数: 5462
2
第二轮都快开始了,请参加比赛,第一轮还没有出场的朋友尽快把时间定下来。
统计组队有:A2,C2,D2,J2,L1,N2组的成员。
成员名单如下:
A2:
beijingdaddy & xddy
Cutiesweetie & walter5928
——————————————————————————————
C2:
huangrong012 & newcop2
dearcih & zzsch
——————————————————————————————
D2:
hometh & nonpro
Kunlunrunyu & Snailcat
——————————————————————————————
J2:
guoging2011 & nandi2012
plucklady & spidermonkey
——————————————————————————————
L1:
Fulai Ran & MIKEVI
pekingduck & xiaoguapi
——————————————————————————————... 阅读全帖
w*******y
发帖数: 60932
3
New Balance N2 Heart Rate Monitor $17.71 with Prime or FSSS at Amazon.
Seems like a very good deal for a entry level heart rate monitor. The model
must be on closeout because it has been discontinued by the manufacturer .
MSRP is $60.00. Has been selling recently for $35-$45. Lowest price
available from a reputable seller (REI) on Google products:
http://www.google.com/products?hl=en&q=new balance n2 heart rate monitor&safe=off&client=firefox-a&scoring=p
is $35.92 including shipping.
The f
w*******p
发帖数: 253
4
There is one MFC, which was calibrated for 100sccm N2, can I use it for
100sccm Cl2? If Yes, will the flow measurement be accurate? Thanks.

发帖数: 1
5
汉语中的26种结构歧义
冯志伟
上世纪80年代我在德国Fraunhofer研究院新信息技术与通讯系统研究所研究中文科
学技术术语结构时,曾经提出了“潜在歧义论”(Potential Ambiguity Theory, 简称
PA论)。PA论认为,语言学家总结出的各种“歧义格式”(我们叫做PT结构[Phrase
Type Structure])的歧义实际上是潜在的歧义,并不是现实的歧义,当我们用具体的
单词来替换歧义格式中的词类符号时(我们叫做“实例化”),这样的潜在歧义可能继
续保持,也可能消失,从而转化为真歧义结构、歧义消失结构。PA论补充了朱德熙先生
关于“歧义格式”的内容,对于语言现象具有更强的解释力。
博主曾经发表过关于科学技术术语中的潜在歧义结构的博文。PA论也同样适合于日
常的语言,它不仅适用于汉语,也适用于英语。今天我们根据“潜在歧义论”(PA论)
来进一步讨论日常语言中的潜在歧义问题。
如果我们用PA论的观点来分析英语和汉语的歧义结构时,我们就会得到相当满意的
... 阅读全帖

发帖数: 1
6
冯志伟
上世纪80年代我在德国Fraunhofer研究院新信息技术与通讯系统研究所研究中文科
学技术术语结构时,曾经提出了“潜在歧义论”(Potential Ambiguity Theory, 简称
PA论)。PA论认为,语言学家总结出的各种“歧义格式”(我们叫做PT结构[Phrase
Type Structure])的歧义实际上是潜在的歧义,并不是现实的歧义,当我们用具体的
单词来替换歧义格式中的词类符号时(我们叫做“实例化”),这样的潜在歧义可能继
续保持,也可能消失,从而转化为真歧义结构、歧义消失结构。PA论补充了朱德熙先生
关于“歧义格式”的内容,对于语言现象具有更强的解释力。
博主曾经发表过关于科学技术术语中的潜在歧义结构的博文。PA论也同样适合于日
常的语言,它不仅适用于汉语,也适用于英语。今天我们根据“潜在歧义论”(PA论)
来进一步讨论日常语言中的潜在歧义问题。
如果我们用PA论的观点来分析英语和汉语的歧义结构时,我们就会得到相当满意的
解释。
英语的“... 阅读全帖
l******i
发帖数: 1404
7
来自主题: Quant版 - 【Brainteaser】Interview Questions
巧妙的严格证明要等傲骨等大牛来解释。
我只会最笨的严格证明:假设
第1个jar里有n1个红球,k1-n1个黑球,总共k1个球;
第2个jar里有n2个红球,k2-n2个黑球,总共k2个球;
第3个jar里有n3个红球,k3-n3个黑球,总共k3个球;
第4个jar里有n4个红球,k4-n4个黑球,总共k4个球;
n1+n2+n3+n4=100; k1+k2+k3+k4=200;(n4=100-n1-n2-n3,k4=200-k1-k2-k3);
n1,n2,n3,n4,k1-n1,k2-n2,k3-n3,k4-n4>=0;k1,k2,k3,k4>=1;
所有自由变量仅有n1,n2,n3,k1,k2,k3;
那红球出现概率P=(1/4)*[n1/k1+n2/k2+n3/k3+(100-n1-n2-n3)/(200-k1-k2-k3)];
然后maximize这个P:
dP/dn1=(1/4)*[1/k1-1/k4];
不失一般性,我们可以认为 k1<=k4;
那么就有dP/dn1>=0, P is maximized at n1=k1 when n2,n3,k1,k2,k3 are fi... 阅读全帖
c********e
发帖数: 383
8
来自主题: Programming版 - optimization
struct Node
{
int i;
int j;
int k;
};
bool compare1 (const Node& n1, const Node& n2)
{
return (n1.i < n2.i)
|| ((n1.i == n2.i)
&& ((n1.j < n2.j)
|| ((n1.j == n2.j) && (n1.k < n2.k))));
}
bool compare2 (const Node& n1, const Node& n2)
{
return (n1.i || ((n1.i == n2.i) && (n1.j < n2.j))
|| ((n1.i == n2.i) && (n1.j == n2.j) && (n1.k < n2.k));
}
to make compare2 as fast as compare1, whats the name of the optimization?
thx
t******g
发帖数: 252
9
来自主题: JobHunting版 - 概率题
M1 M2 M3 M4
0 N1N2
2 N1 N2
2 N1 N2
2 N1 N2
2 N2 N1
0 N1N2
2 N1 N2
2 N1 N2
2 N2 N1
2 N2 N1
0 N1N2
2 N1 N2
2 N2 N1
2 N2 N1
2 N2 N1
0 N1N2
24/16 = 1.5
c********t
发帖数: 5706
10
贴个我的吧,一堆if, 大家轻拍
public boolean isSymmetric(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if(root == null) return true;

if(root.left == null && root.right == null) return true;
if(root.left == null || root.right == null) return false;

Stack s1= new Stack();
Stack s2= new Stack();


s1.push(root.left);
s2.push(roo... 阅读全帖
c********t
发帖数: 5706
11
贴个我的吧,一堆if, 大家轻拍
public boolean isSymmetric(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if(root == null) return true;

if(root.left == null && root.right == null) return true;
if(root.left == null || root.right == null) return false;

Stack s1= new Stack();
Stack s2= new Stack();


s1.push(root.left);
s2.push(roo... 阅读全帖
e****e
发帖数: 418
12
来自主题: JobHunting版 - 狗店面,求BLESS
Bless Louzhu.
Instead of using parentCount, use a map to record its parents. The code
might not be optimal, but it should work.
class TreeNode {
TreeNode left;
TreeNode right;
Map parentCount = new HashMap();
}
private boolean isSame(TreeNode n1, TreeNode n2, TreeNode p1, TreeNode p2) {
if ( n1 == null && n2 == null )
return true;
if ( n1 == null || n2 == null )
return false;

addParent( n1, p1 );
addParent( n2,... 阅读全帖
f*******t
发帖数: 7549
13
来自主题: JobHunting版 - 狗店面,求BLESS
层序遍历+hashmap解法。动手写+test大概25分钟
public static boolean compareTrees(TreeNode tree1, TreeNode tree2) {
if (tree1 == null && tree2 == null)
return true;
else if (tree1 == null || tree2 == null)
return false;
HashMap map = new HashMap();
LinkedList list1 = new LinkedList();
LinkedList list2 = new LinkedList();
list1.add(tree1);
list2.add(tree2)... 阅读全帖
l********1
发帖数: 24
14
来自主题: JobHunting版 - rocket fuel第一轮面经
void dfs(int n1, int n2, int n3, string transfer, set &dict){
if(n1 == 0 && n2 == 0 && n3 == 0){
if(dict.find(transfer) == dict.end()){
dict.insert(transfer);
cout< }
return;
}
if(transfer.size() == 0){
if(n1 > 0){
string temp = "()";
dfs(n1 - 1, n2, n3, temp, dict);
}
if(n2 > 0){
string temp = "[]" ;
dfs(n1, n2 - 1, n3, temp, dict); ... 阅读全帖
e****e
发帖数: 418
15
我来个Recursion code,欢迎指正:
public void print(TreeNode n1, TreeNode n2) {
if ( n1 == null && n2 == null )
return;
else if ( n1 == null && n2 != null )
print(n2);
else if ( n1 != null && n2 == null )
print(n1);
else {
print(n1.left, n2.left)
if( n1.val > n2.val) {
println(n2.val);
println(n1.val);
} else{
println(n1.val);
println(n2.val);
}
print(n1.right, n2.right)
}
}
private void print(TreeNode n) {
if ( n == null )
return... 阅读全帖
e****e
发帖数: 418
16
来自主题: JobHunting版 - 狗店面,求BLESS
Here is the code for the 序号标记 approach. It's surprisingly simple. Thanks
fatalme for posting it out. Sorry for my rusty C/C++.
class TreeNode {
TreeNode left;
TreeNode right;
int no = -1;
}
Initialize: n1.no = 1; n2.no = 1; No = 1;
bool isSame(TreeNode n1, TreeNode n2, int& NO) {
if ( !n1 && !n2 )
return true;
if ( !n1 || !n2 )
return false;
if ( n1.no != n2.no || n1.val != n2.val )
rturn false;

NO++;
n1.left.no = NO;
n2.left.no = N... 阅读全帖
F****n
发帖数: 3271
17
来自主题: JobHunting版 - A家面试题
public void compare(TreeNode n1, TreeNode n2, ListcommonValues) {
if (n1 == null || n2 == null) return;
if (n1.val == n2.val) {
commonValues.add(n1.val);
compare(n1.left, n2.left, commonValues);
compare(n1.right, n2.right, commonValues);
}
else if (n1.val < n2.val) {
compare(n1, n2.left, commonValues);
compare(n1.right, n2, commonValues);
}
else {
compare(n1.left, n2, commonValues);
compare(n1, n2.right, commonValues);
... 阅读全帖
w****x
发帖数: 2483
18
来自主题: JobHunting版 - M 面试问题 (update,
sqrt 就不做了,二分比较熟悉.
second largest:
//Second largest integer
void _inner_2nd(int a[], int n, int& n1, int& n2)
{
if (1 == n)
{
n1 = a[0];
n2 = INT_MIN;
return;
}
int x1,x2;
_inner_2nd(a, n/2, x1, x2);
int y1,y2;
_inner_2nd(a+n/2, n-n/2, y1, y2);
if (x1 > y1)
{
n1 = x1;
if (y1 > x2)
n2 = y1;
else n2 = x2;
}
else
{
n1 = y1;
if (x1 > y2)
n2 = x1;
else n2 = y2... 阅读全帖
b*******e
发帖数: 217
19
my solution:
Recursive Function
Assume i > n1+n2 (can do same for i <= n1 and i > n1 and <= n1+n2)
Exist(i, j, a, b, c) = Exist(i-1, j, a, b, c) || Exist(i-1, j-Si, a, b, c-1)
where i is the index of ith item, j is the total capacity occupied by items
selected, a is the number of S1 item selected, b is the number of S2 item
selected, and c is the number of S3 item selected. note a <= n1, b<=n2 and c
<=n3.
Find all Exist from Exist(0,0,0,0,0) to Exist(n1+n2+n3, C, n1, n2, n3).
(a) If there is a j... 阅读全帖
B****D
发帖数: 132
20
来自主题: JobHunting版 - rocket fuel第一轮面经
这题的思路是这样的.
首先, 因为需要罗列, 速度不是问题, 你必须一一枚举所有有效排列. 因为是打印, 你
不必把所有答案都存起来. 产生一个, 打一个.
这题相当于, 你有三个水管喝水, 如何排列组合的问题. 很明显, 递归是最容易想到的
.
举例来说. 如果是2, 2, 2的情况, 假设你走到某一步, 比如说, 你已经各用了一个左
括号, 每种左括号还各剩一个, 你怎么办?
你有四种选择, 取一个左括号(三种), 或者加一个右括号. 右括号必须与最近一次的左
扩号匹配. 因此, 你需要4个参数.
1. 还剩几个 "("
2. 还剩几个 "["
3. 还剩几个 "{"
4. 当前的结果.
下面是用JAVA写的CODE. 为了方便, 多加了一个参数, 所有目前为止的左括号的STACK.
这是为了不用分析当前结果去找下一个右括号.
public class ListP
{
static int count = 0;
public static void main(String args[])
{
int n1 = 2;
int n... 阅读全帖
B****D
发帖数: 132
21
来自主题: JobHunting版 - rocket fuel第一轮面经
这题的思路是这样的.
首先, 因为需要罗列, 速度不是问题, 你必须一一枚举所有有效排列. 因为是打印, 你
不必把所有答案都存起来. 产生一个, 打一个.
这题相当于, 你有三个水管喝水, 如何排列组合的问题. 很明显, 递归是最容易想到的
.
举例来说. 如果是2, 2, 2的情况, 假设你走到某一步, 比如说, 你已经各用了一个左
括号, 每种左括号还各剩一个, 你怎么办?
你有四种选择, 取一个左括号(三种), 或者加一个右括号. 右括号必须与最近一次的左
扩号匹配. 因此, 你需要4个参数.
1. 还剩几个 "("
2. 还剩几个 "["
3. 还剩几个 "{"
4. 当前的结果.
下面是用JAVA写的CODE. 为了方便, 多加了一个参数, 所有目前为止的左括号的STACK.
这是为了不用分析当前结果去找下一个右括号.
public class ListP
{
static int count = 0;
public static void main(String args[])
{
int n1 = 2;
int n... 阅读全帖
w****r
发帖数: 69
22
来自主题: JobHunting版 - rocket fuel第一轮面经
来个简单易懂的python版, n1是剩余左括号, n1_是剩余右括号
res = []
def gen(sol, stk, n1, n2, n3, n1_, n2_, n3_):
if n1 == 0 and n2 == 0 and n3 == 0 and n1_ == 0 and n2_ == 0 and n3_ ==
0:
res.append("".join(sol))
return

if n1 > 0:
gen(sol[:] + ["("], stk[:] + [1], n1-1, n2, n3, n1_, n2_, n3_)
if n2 > 0:
gen(sol[:] + ["["], stk[:] + [2], n1, n2-1, n3, n1_, n2_, n3_)

if n3 > 0:
gen(sol[:] + ["{"], stk[:] + [3], n1, n2, n3-1, n1_, n2_, n3_)
if len(stk) ... 阅读全帖
k***g
发帖数: 166
23
网上都是2维DP的,我半年前用一个一维数组做出来了,现在却怎么也想不起来是什么
思路,上代码请教一下大家:
int n1 = s1.size(), n2 = s2.size(), n3 = s3.size();
if (n1 + n2 != n3) return false;
deque M(n2+1); M[n2] = true;
for (int j=n2-1; j>=0; j--)
if (!(M[j] = s3[n1+j] == s2[j] && M[j+1]))
break;
for (int i=n1-1; i>=0; i--) {
for (int j=n2-1; j>=0; j--) {
if ( s3[i+j] == s1[i] && M[j] )
M[j] = true;
else if ( s3[i+j] == s2[j] && M[j+1] )
M[j] = true;
else
M[j] = fals... 阅读全帖
z*****5
发帖数: 1871
24
新手,为改变命运每天挑灯夜练,望指教,谢谢!
public static Node add(Node n1, Node n2) {
if (n1==null || n2==null) return null;

int carry = 0;
Node result = new Node(0);
Node p = result;

while (n1!=null || n2!=null) {
p.data = (n1==null ? n2.data : n2==null ? n1.data : (n1.data+n2.
data)%10) + carry; //此处报NullPointerException异常;
carry = p.data<10 ? 0 : 1;
n1 = n1.next;
n2 = n2.next;
p = p.next;... 阅读全帖
e****e
发帖数: 418
25
来自主题: JobHunting版 - 狗店面,求BLESS
Code for 不改动树。用一个Map记录每个node有多少parents.
Map map = new HashMap();
boolean isSame(TreeNode n1, TreeNode n2) {
if ( n1 == null && n2 == null )
return true;
if ( n1 == null || n2 == null )
return false;
setMap( n1 );
setMap( n2 );
return map.get(n1) == map.get(n2) && n1.val == n2.val && isSame( n1.left
, n2.left ) && isSame( n1.right, n2.right );
}
void setMap(TreeNode n) {
if ( map.containsKey( n ) )
map.put( n,... 阅读全帖
c*******e
发帖数: 621
26
所有recursive的题都能用stack做 你要熟悉啊
tripadvisor考到过
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSymmetric(TreeNode *root) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(root==NULL)return true;
if(root->left==NULL||root->right==NULL){
if(root->left==NULL&&r... 阅读全帖
k**********g
发帖数: 989
27
来自主题: Programming版 - 请教一个算法题关于shortest path的

好像是正解.
A shortest path from n0 (starting point) to ny (any point) can be classified
as:
n0 ... ... ny (not touching any constrained point), OR
n0 ... n2 ... ny (touching only n2), OR
n0 ... n5 ... ny (touching only n5), OR
... (more combinations if there are additional constrains)
The best result from the first class is simply computed by removing all
constrained points from the graph.
For each of the remaining classes, the search can be broken down into:
(e.g. for the class that allows n2, r... 阅读全帖
g******s
发帖数: 733
28
for n2=1:pixels
for n1=1:pixels
r=sqrt((n1-pixels/2)^2+(n2-pixels/2)^2)*lenssize/pixels;
if r tobeknown(n1,n2)=pi;
elseif r tobeknown(n1,n2)=0;
elseif r tobeknown(n1,n2)=pi;
elseif r tobeknown(n1,n2)=0;
.........
else if r tobeknown(n1,n2)=pi;
else
tobeknown(n1,n2)=0;
end
end
end
s****d
发帖数: 14
29
http://www.hftradingbook.com/content/index.php?option=com_jumi&
Statistical Arbitrage(cpp文件)
内容如下:
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
void AnalyzePair(char* symbol1, char* symbol2)
{
double close1[100] = {0};
int n1 = 0, dates1[100] = {0};
double close2[100] = {0};
int n2 = 0, dates2... 阅读全帖
R***i
发帖数: 78
30
来自主题: JobHunting版 - Bloomberg on campus 面试题2道
1.
public boolean isTreeSame(TreeNode n1, TreeNode n2){
if (n1==null && n2==null) return true;
if (n1==null && n2!=null) return false;
if (n1!=null && n2==null) return false;
if (n1.value != n2.value) return false;
return true && isTreeSame(n1.left, n2.left) && isTreeSame(n1.right, n2.
right);
}
d*******d
发帖数: 2050
31
来自主题: JobHunting版 - 问个google面试题
这好办
int maxsum(Node * root, int & maxpathsum, Node * & maxpathNode,
int sumtohere, Node * & n1, Node * & n2){
if( root== NULL){
maxpathsum = sumtohere;
maxpathNode = NULL;
n1 = NULL;
n2 = NULL;
return 0;
}
int left_maxpathsum = 0;
Node * leftNode1;
Node * leftNode2;
Node * left_maxpathNode;
int left_maxsum = maxsum( root->left, left_maxpathsum, left_maxpathNode,
sumtohere+root->v, leftNode1, leftNode2);
int right_max... 阅读全帖
S**I
发帖数: 15689
32
来自主题: JobHunting版 - [合集] 问个google面试题
☆─────────────────────────────────────☆
Bayesian1 (Jason) 于 (Tue Jun 21 01:52:31 2011, 美东) 提到:
Given a binary tree, find 2 leaf nodes say X and Y such that F(X,Y) is
maximum where F(X,Y) = sum of nodes in the path from root to X + sum of
nodes in the path from root to Y - sum of nodes in the common path from root
to first common ancestor of the Nodes X and Y
☆─────────────────────────────────────☆
SecretVest (Secret Vest) 于 (Tue Jun 21 04:01:30 2011, 美东) 提到:
not hard if someone is used... 阅读全帖
j********g
发帖数: 80
33
你的代码稍微改改逻辑就不用那么多NULL判断了。C++写的,不太清楚java里对null的
处理。
class Solution {
public:
bool isSymmetric(TreeNode *root) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(root == NULL)
return true;

stack s1;
stack s2;

s1.push(root->left);
s2.push(root->right);

while(!s1.empty()&& !s2.empty()){
TreeNode* n1 = s1.top();
TreeNode* ... 阅读全帖
j********g
发帖数: 80
34
你的代码稍微改改逻辑就不用那么多NULL判断了。C++写的,不太清楚java里对null的
处理。
class Solution {
public:
bool isSymmetric(TreeNode *root) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(root == NULL)
return true;

stack s1;
stack s2;

s1.push(root->left);
s2.push(root->right);

while(!s1.empty()&& !s2.empty()){
TreeNode* n1 = s1.top();
TreeNode* ... 阅读全帖
e****e
发帖数: 418
35
来自主题: JobHunting版 - 狗店面,求BLESS
class TreeNode {
TreeNode left;
TreeNode right;
int parentCount;
}
private boolean isSame(TreeNode n1, TreeNode n2) {
if ( n1 == null && n2 == null )
return true;
if ( n1 == null || n2 == null )
return false;
return ++n1.parentCount == ++n2.parentCount && n1.val == n2.val &&
isSame( n1.left, n2.left ) && isSame( n1.right, n2.right );
}
s********x
发帖数: 914
36
来自主题: JobHunting版 - 有些面试题是够扯蛋的
我找到proof啦 - quick sort worst case is nlog(n)
Data Structures
& Algorithms
in Java
Second Edition
Robert Lafore
page 725
TABLE 15.3 Comparison of Sorting Algorithms
Sort Average Worst Comparison Extra Memory
Bubble O(N2) O(N2) Poor No
Selection O(N2) O(N2) Fair No
Insertion O(N2) O(N2) Good No
Shellsort O(N3/2) O(N3/2) — No
Quicksort O(N*logN) O(N2) Good No
Mergesort O(N*logN) O(N*logN) Fair Yes
Heapsort O(N*logN) O(N*logN) Fair No
M******7
发帖数: 30
37
来自主题: JobHunting版 - Facebook interview questions
public Node getMedian(Node head){
if(head==null)return head;
Node p1=head;
Node p2=head;
while(p2.next!=null&&p2.next.next!=null){
p1=p1.next;
p2=p2.next.next;
}
return p1;
}
public Node Merge(Node n1, Node n2){
Node cur=new Node(-1);
Node head=cur;
while(n1!=null&&n2!=null){
if(n1.value<=n2.value){
cur.next=n1;
n1=n1.next;
}else{
... 阅读全帖
s********x
发帖数: 914
38
切磋一下

public static ArrayList multiplyBigInterger(List num1,
List num2) {
if (num1 == null || num1.isEmpty() || num2 == null || num2.isEmpty()
) {
throw new IllegalArgumentException("Invalid input");
}
if (num1.size() < num2.size()) {
return multiplyBigInterger(num2, num1);
}
// num1.size() >= num2.size()
ArrayList result = new ArrayList(num1.size()
... 阅读全帖
z*********e
发帖数: 10149
39
来自主题: JobHunting版 - leetcode是不是最近有点问题?
这是按照sdx写的valid number,
显示 Runtime Error Message: Line 5: java.lang.
StringIndexOutOfBoundsException: String index out of range: 0
Last executed input: "3"
就是说这一行有错"if(s.charAt(0) == '+' || s.charAt(0) == '-') s = s.
substring(1);"
明显不可能麻,我空string都处理了还说我越界
===============================================
public boolean isNumber(String s) {
if(s == null || s.isEmpty()) return false;
s = s.trim();
if(s.charAt(0) == '+' || s.charAt(0) == '-') s = s.substring(1);
... 阅读全帖
a**s
发帖数: 9606
40
来自主题: Tennis版 - VirtualDub视频编辑简单步骤
def ReadVDScript(strJsFile):
lstSubs=[]
lstVideoFile=[]
strOutFile = ""
fpJs=open(strJsFile, 'r')
strScript=fpJs.read()
fpJs.close()

# Get videos source(s)
# VirtualDub.Open("2012.12.08.vs.Tim.avi","",0);
# VirtualDub.append("2.MOV")
n1 = strScript.find('.Open') + 5
if n1>4:
n1 = strScript.find('"', n1) + 1
lstVideoFile.append(strScript[n1:strScript.find('"', n1)])
... 阅读全帖
a**s
发帖数: 9606
41
来自主题: Tennis版 - VirtualDub视频编辑简单步骤
def ReadVDScript(strJsFile):
lstSubs=[]
lstVideoFile=[]
strOutFile = ""
fpJs=open(strJsFile, 'r')
strScript=fpJs.read()
fpJs.close()

# Get videos source(s)
# VirtualDub.Open("2012.12.08.vs.Tim.avi","",0);
# VirtualDub.append("2.MOV")
n1 = strScript.find('.Open') + 5
if n1>4:
n1 = strScript.find('"', n1) + 1
lstVideoFile.append(strScript[n1:strScript.find('"', n1)])
... 阅读全帖
p*q
发帖数: 312
42
来自主题: Mathematics版 - 请教大牛们一个概率问题
n1*n2/N这个结果好像是对的,还需大牛讲解一下。
得到下面这个式子不知道如何化简,代入数值跟n1*n2/N是一致的。
sum{i*C(N,i)*C(N-i,n1+n2-2*i)*C(n1+n2-2*i,n1-i)}/(C(N,n1)*C(N,n2));
i
i=[max(1,n1+n2-N):min(n1,n2)]为重复人数
x*******6
发帖数: 994
43
还记得科幻作品里面威力堪比核武器而没有核污染的”N2爆弹”吗?中国造出来了。南
京理工大学化工学院胡炳成教授团队近日成功合成世界首个全氮阴离子盐,占领新一代
超高能含能材料研究国际制高点。相关研究论文27日发表在国际顶级期刊《科学》上,
这也是我国在《科学》上发表的含能材料领域第一篇研究论文。
“N2炸弹”的威力
据南理工网站报道,此次合成的化合物含有全氮阴离子(N5-)。据相关论文,全氮类超
高含能材料(炸药)的能量可达3倍TNT以上,具备高密度、高能量、爆轰产物清洁无污
染(爆炸产物为氮气,无污染)、稳定安全等特点。全氮类物质的相关研究将直接推动
超高含能材料的快速进步,相关材料的研制成功有望在炸药、发射药和推进剂领域产生
惊人的发展。
据报道,在世界范围内,获取全氮阴离子都是一个难题,自1772年从大气中分离出来N2
以后,直到1890年,才发现第一种全氮离子N3-,此后相关研究止步不前。科研工作者
对从N3到N13的各种全氮衍生物进行了大量的理论预测,但真正制取成功相关化合物的
成果少之又少。用于制备全氮离子的前驱体芳基五唑直到1956年才首次被合成;1999年
,美国空军研究... 阅读全帖
z****r
发帖数: 184
44
诸位高手,
现在在写一个报告, 涉及到高分子孔洞测量 (characterizing porosity in highly
porous polymers). 一般文献都说用 N2
gas 在 77K做吸附实验, 大概所谓的 BET 方法。 因为我不在这个专业,现有一些问
题请教行家:
(1) 为什么一定要用 N2 gas? 别的气体不行么? H2 分子更小, 岂不更适合做测试
分子(detecting molecules)?
(2) 为什么一定要在 77K? 因为是 N2 气体的 boiling point? 那么为何一定要在
boiling point?
(3)BET 方法具体给出什么方面的信息? 孔洞内表面积 (internal surface), 大小
(diameter for pores), 空洞大小的分布
(size distribution), 自由体积的百分比 (percentage of free volume)?
(4)N2 吸附方法, BET方法所测的孔洞下限是多大? 因为 N2 gas 分子有一定大小
,一定不能被它更小的孔洞所吸附,
但具体的下限是多少?
(... 阅读全帖
s*********t
发帖数: 1663
45
来自主题: JobHunting版 - 问个编程题
我随便写了一个,凑合看下吧。。
std::set fibRange(int m, int n)
{
assert(m<=n);
std::set Set;
std::stringstream ss;
std::string s;
int n1,n2, tmp;
for(int i=1; ; i++){
n1 = i;
n2 = i+i;
ss.str("");
ss< s = ss.str();
if(atoi(s.c_str()) > n){
break;
}
while( atoi(s.c_str()) < m){
tmp = n1 + n2;
n1 = n2;
n2 = tmp;
ss< s = ss.str();
c********t
发帖数: 5706
46
土了,发现原来java stack和queue都允许null,只是我自己代码开始逻辑有问题。修改
后的DFS如下,过了。
public boolean isSymmetric2(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return true;
Stack s1 = new Stack();
Stack s2 = new Stack();
s1.push(root.left);
s2.push(root.right);
while (!s1.isEmpty() && !s2.isEmpty()) {
TreeNode n1 = s1.pop();
TreeNode n2 = s2.pop();
if (n1 =... 阅读全帖
c********t
发帖数: 5706
47
土了,发现原来java stack和queue都允许null,只是我自己代码开始逻辑有问题。修改
后的DFS如下,过了。
public boolean isSymmetric2(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return true;
Stack s1 = new Stack();
Stack s2 = new Stack();
s1.push(root.left);
s2.push(root.right);
while (!s1.isEmpty() && !s2.isEmpty()) {
TreeNode n1 = s1.pop();
TreeNode n2 = s2.pop();
if (n1 =... 阅读全帖
o***d
发帖数: 313
48
来自主题: JobHunting版 - 狗店面,求BLESS
大牛,我仔细重新看了一下第一题,不明白到底题意是什么,能再解释一下么?
我猜的Node:
//each node can have at most two parents
struct Node
{
Node* left;
Node* right;
Node* leftParent;
Node* rightParent;
};
//另一种
struct Node
{
Node* left;
Node* right;
vector parents;
};
问题1:================================================
从父亲到子节点是可以双向访问的?换句话说,如果一个子节点有一个父节点,那么从父
节点也可以访问到资节点?
如果是这样,我觉得单纯用parents就可以搞定这题,不需要加标号阿.你后面回帖的反例
里面,一个节点有3个父节点.那么你在查找这个子节点时,仍然能发现一个树的父节点有
3个,另一个只有两个阿.
我找不到反例。
//P-code
//return false if any check f... 阅读全帖
I**********s
发帖数: 441
49
也用stack. 简洁一些,也能过。
bool isSymmetric3(TreeNode * root) {
if (! root) return true;
stack s1, s2;
s1.push(root->left);
s2.push(root->right);

while(! s1.empty() && ! s2.empty()) {
TreeNode * n1 = s1.top(); s1.pop();
TreeNode * n2 = s2.top(); s2.pop();

if (!n1 && !n2) continue;
if (!n1 || !n2 || n1->val != n2->val) return false;

s1.push(n1->left);
... 阅读全帖
I**********s
发帖数: 441
50
完全相同的结构,改用queue, 也能过:
bool isSymmetric(TreeNode * root) {
if (! root) return true;
queue s1, s2;
s1.push(root->left);
s2.push(root->right);

while(! s1.empty() && ! s2.empty()) {
TreeNode * n1 = s1.front(); s1.pop();
TreeNode * n2 = s2.front(); s2.pop();

if (!n1 && !n2) continue;
if (!n1 || !n2 || n1->val != n2->val) return false;

s1.push(n1->left);
... 阅读全帖
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)