由买买提看人间百态

topics

全部话题 - 话题: elses
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
Y**u
发帖数: 5466
1
☆─────────────────────────────────────☆
TrueStory (不是幸福的坑不挖) 于 (Wed Nov 23 14:09:26 2011, 美东) 提到:
Carl Jung published a lot after this NDE, and this was one of his two major "creative" illnesses he experienced (suffered or blessed). The other one was the deep depression he experienced after his break-up with Freud (several of Freud's former disci
committed suicide after such break-ups.)
Update: I found a link with the same content, but perhaps it's easier to read than the pure text below:
h... 阅读全帖
z***s
发帖数: 3241
2
来自主题: Java版 - 是不是spring mvc用的很少
http://coolshell.cn/articles/8745.html
如此理解面向对象编程
2012年12月13日陈皓发表评论阅读评论 20,225 人阅读
从Rob Pike 的 Google+上的一个推看到了一篇叫《Understanding Object Oriented
Programming》的文章,我先把这篇文章简述一下,然后再说说老牌黑客Rob Pike的评
论。
先看这篇教程是怎么来讲述OOP的。它先给了下面这个问题,这个问题需要输出一段关
于操作系统的文字:假设Unix很不错,Windows很差。
这个把下面这段代码描述成是Hacker Solution。(这帮人觉得下面这叫黑客?我估计
这帮人真是没看过C语言的代码)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class PrintOS
{
public static void main(final String[] args)
{
String osName = System.getProperty("... 阅读全帖
a***k
发帖数: 1038
3
来自主题: Military版 - 红死病 by 杰克.伦敦 (转载)
【 以下文字转载自 paladin 讨论区 】
发信人: atack (小军号), 信区: paladin
标 题: 红死病 by 杰克.伦敦
发信站: BBS 未名空间站 (Sat Oct 11 07:40:15 2014, 美东)
I
The way led along upon what had once been the embankment of a railroad. But
no train had run upon it for many years. The forest on either side swelled
up the slopes of the embankment and crested across it in a green wave of
trees and bushes. The trail was as narrow as a man's body, and was no more
than a wild-animal runway.
Occasionally, a piece of rusty iron, showing through ... 阅读全帖
d***8
发帖数: 1552
4
来自主题: JobHunting版 - 谷歌 电面
BinaryTree* findnextnode(BinaryTree *root, int node_val)
{
stack stk;
BinaryTree *cur = root;
//Find match node
while(cur != NULL)
{
stk.push(cur);
if(cur->value == node_val)
break;
else if (cur->value < node_val)
cur = cur->right;
else if(cur->value > node_val)
cur = cur->left;
}
if (cur == NULL)... 阅读全帖
w**t
发帖数: 23
5
来自主题: JobHunting版 - Lowest Common Ancestor
小弟在看careercup,其中有一题是求二叉树两个节点的Lowest Common Ancestor。
书中先给出一种解法:
1 public Tree commonAncestor(Tree root, Tree p, Tree q) {
2 if (covers(root.left, p) && covers(root.left, q))
3 return commonAncestor(root.left, p, q);
4 if (covers(root.right, p) && covers(root.right, q))
5 return commonAncestor(root.right, p, q);
6 return root;
7 }
8 private boolean covers(Tree root, Tree p) { /* is p a child of root?
*/
9 if (root == null) return false;
10 if (root == p) return true;
11 return covers(root.left, p... 阅读全帖
z*d
发帖数: 18
6
来自主题: JobHunting版 - 问一道 ama的除法题
How about this one? Any suggestions or corrections will be highly
appreciated.
#include
#include
int divide (int x, int y) {
long long dividend, divisor, sign_dividend, sign_divisor;
long long low, middle, high;
int quotient;
/* check whether divisor is 0 */
if (y == 0) {
printf("Dvided by 0 error! \n");
assert(0);
}

/* unsign both dividend and divisor and mark the signess */
if (x < 0) {
dividend = -x;
sign... 阅读全帖
y***m
发帖数: 7027
7
来自主题: JobHunting版 - 乘方函数还有简解么
一个java稍微优化的,请指点更优化解,thx!
public static double pow(double a, int b) {
if (b == 0)
return 1;
else if (b == 1)
return a;
else if (b == -1)
return a;
else if (b == 1)
return 1 / a;
else if (b == 2)
return a * a;
else if (b == -2)
return 1 / (a * a);
... 阅读全帖
b***e
发帖数: 15201
8
来自主题: JobHunting版 - A家来两道电面题
我后来做出来的解法:
public static int countComps(int[][] a)
{
int m=a.length;//row length
int n=a[0].length; //col length
int label=2;

HashSet equal_labels = new HashSet();

int west=0;
int north=0;

for (int i=0;i for (int j=0;j {
if (a[i][j]!=0)
{
if (i==0 && j==0)
{
... 阅读全帖
b***e
发帖数: 15201
9
来自主题: JobHunting版 - A家来两道电面题
前面贴出来的解法还有个Bug,数组前几行都是0的时候,返回值差1:
这个是改正的版本。
public static int countComps(int[][] a)
{
int m=a.length;//row length
int n=a[0].length; //col length
int label=1;//label init value is 1 but will start with 2,increase
by 1 when find 1 possible new component

HashSet equal_labels = new HashSet();//to save equivalent label
pairs,no duplicates
//return result would be

int west=0;
int north=0;

... 阅读全帖
S**I
发帖数: 15689
10
来自主题: JobHunting版 - [合集] G一面,感觉不咋的
☆─────────────────────────────────────☆
libei (Bei) 于 (Wed Jan 11 15:43:39 2012, 美东) 提到:
面试官是Google+组的,
一上来她说看到我简历上的一篇测试自动化的文章,读了一遍,感觉"very
informative",让后让我介绍一下相关经验。让我小高兴了一下。
第一题是coding,做的还算顺利,后来她评价说所有的cases都覆盖到了。可能算是过
关吧。
第二题我想复杂了,然后在她提示下才解决。自我感觉很不好。其实sort一下就差不多
了,不过我往复杂的树结构想去了。虽然树结构确实能解决这个问题,不过当时我解释
得很不清楚。反正很不爽。
最后瞎聊时间,她说我提到的测试自动化实践和Google内部的基本完全一样blahblah。
。。,不过我觉得这点也算不上加分吧,是个人进google一段时间后都能学会。就怕她
觉得我想问题太复杂,直接negative。
大家有啥建议想法??
☆─────────────────────────────────────☆
peking2 (myfac... 阅读全帖
C***U
发帖数: 2406
11
#include
#include
#include
#define MAX 10000
int main(int argc, char *argv[]){
std::vector numbers1;
std::vector numbers2;
int k = atoi(argv[3]);
if(argc < 4)
std::cout << "we need 2 files and a number." << std::endl;
std::cout << "we need find " << k << "th number" << std::endl;
std::cout << "reading first array of numbers ..." << std::endl;
std::ifstream f1(argv[1]);
if(!f1){
std::cout << "cannot open... 阅读全帖
l*********8
发帖数: 4642
12
来自主题: JobHunting版 - 这题也可以DP 解吧?
Look at the formulas once more:
if A[i]>j
S[i][j] = 0;
else if A[i] == j
S[i][j] = 1;
else
S[i][j] = SS[i-1][j-A[j]] // SS[x][y] 代表 sum (S[k][y]} | when
k = 0...k );

SS[i][j] = SS[i-1][j] + S[i][j];
maybe we only need SS but not S.
if A[i] > j
SS[i][j] == SS[i-1][j]
else if A[i] == j
SS[i][j] = SS[i-1][j] + 1;
else
SS[i][j] += SS[i-1][j-A[j]];
If we use j-- instead of j++ for the loop
then we have
if A[i] > j
SS[j] == SS[j]
else if A[i] == j
SS[j] = SS[j] + 1;
else... 阅读全帖
c****g
发帖数: 85
13
来自主题: JobHunting版 - leetcode上wild match
I guess there is a little error:
else if(*p=='?' || *p==*s)
return isMatch(s+1,p+1);
How about the both are '*'?

class Solution {
public:
bool isMatch(const char *s, const char *p) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(*s=='\0'){
if(*p=='\0')
return true;
else if(*p=='*')
return isMatch(s, p+1);
else
return false;
}
... 阅读全帖
K*********n
发帖数: 2852
14
我也写了一个C的:
Node *del(Node *tree, int n){
Node *tmpNode;
if (tree == NULL)
perror("Element not found.");
else if (tree -> val > n) // go left
tree -> left = del(tree -> left, n);
else if (tree -> val < n)
tree -> right = del(tree -> right, n);
else{ // found n
if (tree -> left && tree -> right){ // two children
tmpNode = findMin(tree -> right);
tree -> ... 阅读全帖
r********g
发帖数: 1351
15
来自主题: JobHunting版 - 2道面试题.
第一题记得是用两个list来记录正的最大值和负的最大值。但是corner case不是很清
楚:
比如:如果只有一个元素,是负数,那返回这个负数,还是返回0呢?(0的意思可以理
解成0个连续元素)。
int maxSubArray(int A[], int n) {
if(n == 0) return 0;
//init
int *minList = new int[n];
int *maxList = new int[n];
memset(minList, 0, sizeof(int)*n);
memset(maxList, 0, sizeof(int)*n);
int maxP = 0;
if(A[0] > 0) {
maxList[0] = A[0];
maxP = A[0];
}
else minList[0] = A[0];

//compute
for(int i = 1; i < n; i++){
if(A[i] == 0)... 阅读全帖
y***m
发帖数: 7027
16
来自主题: JobHunting版 - G一道题
这样可否:
二分递归思路, 假设都是正整数, 数组 a[n]
f 函数三比一, g 函数二分递归
bool f(a1,a2,a3)
{
return a2 }

int g(a[1..n])
{
if n 偶:
if n >= 4
{
m=n/2
if f(a[m-1],a[m],a[m+1])
return a[m];
else if f(a[m],a[m+1],a[m+2])
return a[m=1];
else
{
int rst = g(a[1...m/2]);
if(rst>0)
return rst;
else
return g(a[m/2...n]);
}
}
else
return -1;

////////////////... 阅读全帖
l*******b
发帖数: 2586
17
这个递归写得好简洁呀。。。贴个自己写的,这题总觉得边界情况太复杂
double find_medium(int A[], int m, int B[], int n) {
int flag = (m + n) % 2;
int k = (m + n) /2;
if(flag)
return one_side_k(A,m,B,n,k) | one_side_k(B,n,A,m,k);
else
return ((double)(one_side_k(A,m,B,n,k-1) | one_side_k(B,n,A,m,k-
1))
+ (one_side_k(A,m,B,n,k) | one_side_k(B,n,A,m,k))) /2;
}
int one_side_k(int A[], int m, int B[], int n, int k){
if(0 == n) return A[k];
... 阅读全帖
c*****a
发帖数: 808
18
我的不简洁了.....brute force.....
面试肯定fail
public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {
// Start typing your Java solution below
// DO NOT write main() function
if(A.length==0){
if(B.length % 2 ==1)
return (double) B[B.length/2];
else
return (double)(B[B.length/2] + B[B.length/2-1]) /2;
}
if(B.length ==0){
if(A.length % 2 ==1)
return (double)A... 阅读全帖
l*******b
发帖数: 2586
19
这个递归写得好简洁呀。。。贴个自己写的,这题总觉得边界情况太复杂
double find_medium(int A[], int m, int B[], int n) {
int flag = (m + n) % 2;
int k = (m + n) /2;
if(flag)
return one_side_k(A,m,B,n,k) | one_side_k(B,n,A,m,k);
else
return ((double)(one_side_k(A,m,B,n,k-1) | one_side_k(B,n,A,m,k-
1))
+ (one_side_k(A,m,B,n,k) | one_side_k(B,n,A,m,k))) /2;
}
int one_side_k(int A[], int m, int B[], int n, int k){
if(0 == n) return A[k];
... 阅读全帖
c*****a
发帖数: 808
20
我的不简洁了.....brute force.....
面试肯定fail
public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {
// Start typing your Java solution below
// DO NOT write main() function
if(A.length==0){
if(B.length % 2 ==1)
return (double) B[B.length/2];
else
return (double)(B[B.length/2] + B[B.length/2-1]) /2;
}
if(B.length ==0){
if(A.length % 2 ==1)
return (double)A... 阅读全帖
h*******0
发帖数: 270
21
来自主题: JobHunting版 - 2道算法题。 求教大家!
一个小公司的面试题
第一题就是让写一个stack machine。 就是计算一个类似于“13*6+”这样的string。
读到数就把数字push到stack里面。 如果读到operator, 就pop出来2个数字。 然后计
算,再把计算结果push到stack。 重复直到计算出最终结果。
第二题找array的magnitude pole. 就是找一个点,所有左边的数字均小于等于它,所
有右边的数字都大于等于它。要求O(n)。
第一题,我写的code,大数据的case时候很慢。大家看看有什么能提高的?
int calculator(int op1, int op2, const char opt){
if(opt == '+'){
return op1+op2;
}else if(opt == '/'){
if(op2 == 0) return -1;
return op1/op2;
}else if(opt == '*'){
return op1*op2;
}else if(opt == '... 阅读全帖
p*****p
发帖数: 379
22
public boolean delete(int val) {
if (_remove(val, root) != null) {
return true;
}
else {
return false;
}
}
private Node _remove(int val, Node t) {
if (t == null) {
return null;
}
else if (val < t.val) {
t.left = _remove(val, t.left);
}
else if (val > t.val) {
t.right = _remove(val, t.right);
}
else if (t.left != null && t.right != null){
//two children
t.val = _findMin(t.right).val;
t.righ... 阅读全帖
b******7
发帖数: 92
23
来自主题: JobHunting版 - implement 3 stack in an array
注意左移右移就行了
第一个栈[0...capacity0 - 1)
第二、三个栈[capacity0,...,N)分别一个从头开始++,一个从尾开始--
当第一个栈满而第二、三个栈不满时,做右移操作
反过来,但第二、三个栈满,而第一个栈伟满时,做左移操作
template
class TripleStack{
public:
TripleStack()
{
head0 = 0;
head1 = capacity0 = N/3;
head2 = N-1;
}
void push0(const T & e)
{
if(!isSubStackFull(0))
arr[head0++] = e;
else if(!isSubStackFull(1))
{
shiftRight();
arr[head0++] = e;
}
... 阅读全帖
t*******7
发帖数: 63
24
来自主题: JobHunting版 - G面经 求bless
感谢楼主分享,下礼拜电面,紧张ING。。。本人去年12月PHD毕业,专业方向DATA
MINING AND MACHINE LEARNING,搬到湾区找工作,OPT快开始了,目前还没着落,希望
能和一起在湾区找工作的同学多多交流互通信息。毕业前没时间准备现在着急了。。。
平常MATLAB写得多,JAVA最近才开始练习。。。
把电面的两个题写了一下,请拍
第一题
public boolean judgeCapital(String inputString) {

//
if ((inputString==null) || (inputString.length() == 0)) {

return false;
}



// get the first character
char firstChar = inputString.charAt(0);

//
i... 阅读全帖
f**********t
发帖数: 1001
25
Well, my code is complex and sigfault. Let me go back if I have time.
This is too hard for a 45 minutes interview.
void skipSpace(const char **s) {
while (isspace(**s)) {
++(*s);
}
}
int getNum(const char **s) {
bool neg = false;
if (**s == '-') {
neg = true;
++(*s);
}
int cur = 0;
while (isdigit(**s)) {
cur = cur * 10 + (**s - '0');
++(*s);
}
--(*s);
return neg ? -cur : cur;
}
int opNum(int x, int y, char op) {
switch (op) {
case '+':
return x + y... 阅读全帖
S*******C
发帖数: 822
26
我已经写了一个,请大家看一下还有什么可以改进的地方
package design_a_pizza_maker;
/*
* @ServiceNow onsite
*/
import java.util.Scanner;
import java.util.Timer;
import java.util.TimerTask;
public class PizzaMaker extends Stopwatch{
public static void main(String[] args) {
PizzaMaker pizzamaker = new PizzaMaker();
Scanner sc = new Scanner(System.in);
System.out.println("Input a to add 30 seconds to current baking
schedule");
System.out.println("Input c to cancel current baking schedule");... 阅读全帖
p****x
发帖数: 4260
27
☆─────────────────────────────────────☆
Trueman (楚门) 于 (Tue Apr 26 15:08:49 2011, 美东) 提到:
Get unlimited cash back for all your purchases, including 6% cash back at
supermarkets, 3% cash back at gas stations and department stores, and 1%
back everywhere else.
如果没有$75的年费,就是神卡一张了
还有原来的Blue cash card member可以转到Blue cash everyday,3% on Grocery and 2% on gas/department store, 1% everything else. No annual fee
Damned good card.
AF card will be better if you spend more than $200 monthly on Grocery
... 阅读全帖
l**********1
发帖数: 163
28
ELS是全球依托大学校园从事英文语言教学的最大中心网络,拥有40多个遍布全美各地
的ELS中心,提供专业的英语教育和美国本科/研究生的预科课程。
大部分ELS中心大部分位于大学校园内,环境优美,设施齐全。所有通过ELS密集英语课
程的学生,无需参加TOEFL考试,即可直接申请全美550所大学和研究生院。
ELS - 主办大学列表,表中所有学校校内都有一个ELS语言中心,并且接受ELS等级证书
代替托福成绩.
Johnson & Wales University - Charlotte
Laramie County Community College-Cheyenne
Adelphi University
Barry University
Belmont University
Case Western Reserve University
... 阅读全帖
S******t
发帖数: 8388
29
来自主题: Stock版 - 听歌啦
翻出我收藏的3个Nothing else matter.
http://www.youtube.com/watch?v=Y_4515PnZmc&feature=player_embed
http://www.youtube.com/watch?v=rbTozgoj9OQ&feature=related
http://www.youtube.com/watch?v=bAsA00-5KoI&feature=related
So close, no matter how far
Couldn't be much more from the heart
Forever trusting who we are
and nothing else matters
Never opened myself this way
Life is ours, we live it our way
All these words I don't just say
and nothing else matters
Trust I seek and I find in you
Every day for us som... 阅读全帖
x**********g
发帖数: 82
30
来自主题: EB23版 - 写程序处理perm 数据
Python program
# Authored by xiaofeixiang
# Copyright reserved to EBC23
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTI... 阅读全帖
j*a
发帖数: 14423
31
来自主题: HongKong版 - [合集] 请搞清楚 2
☆─────────────────────────────────────☆
JYH (JYH) 于 (Tue Jan 31 11:09:51 2012, 美东) 提到:
1) i2, you are not welcome here. So do not come in or stay but do get out.
2) i2, if you can't control yourself, go find something else to play with.
Just don't come here. You are not worthy.
3) I don't dislike mainlanders, only the i2 type; I have plenty good friends
who are from the mainland.

Peace!
☆─────────────────────────────────────☆
JYH (JYH) 于 (Tue Jan 31 11:10:47 2012, 美东) 提到:
大陆只是中国的一... 阅读全帖
s*********0
发帖数: 2045
32
来自主题: SanDiego版 - Web-Based EB1/NIW Self-Evaluation System!
直接说出来不就完了:
if (publications >= 8 && citations >=150) {
if (reviews >= 10) {result = "Your case is a very strong EB1A case with
our unique and effective strategies of representation. Please email your
resume to [email protected]
/* */ for further evaluation.";}
else {result = "Your case is a very strong EB1A case (with at least 10
reviews) with our unique and effective strategies of representation. Please
email your resume to [email protected]
/* */ for further evaluation.";} ... 阅读全帖
d**********o
发帖数: 1321
33
来自主题: WebRadio版 - 潜水员冒泡兼征版友意见
第一个项目report
这时偶刚到CSAC工作不久,与小A同学还不熟,我用的还是latex。随着贴的作业越来越
多,应该是用有共同爱好的小伙伴更亲密些。这次贴latex,下次才再org-mode。
\documentclass[b5paper,11pt, abstraction, titlepage]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{listings}
\usepackage{geometry}
\geometry{b5paper}
\usepackage{graphicx,floatrow}
\usepackage{graphicx,subfigure}
\newsavebox{\abstractbox}
\renewenvironment{abstract}
{\begin{lrbox}{0}\begin{minipage}{\t... 阅读全帖
d**********o
发帖数: 1321
34
来自主题: WebRadio版 - 潜水员冒泡兼征版友意见
第一个项目report
这时偶刚到CSAC工作不久,与小A同学还不熟,我用的还是latex。随着贴的作业越来越
多,应该是用有共同爱好的小伙伴更亲密些。这次贴latex,下次才再org-mode。
\documentclass[b5paper,11pt, abstraction, titlepage]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{listings}
\usepackage{geometry}
\geometry{b5paper}
\usepackage{graphicx,floatrow}
\usepackage{graphicx,subfigure}
\newsavebox{\abstractbox}
\renewenvironment{abstract}
{\begin{lrbox}{0}\begin{minipage}{\t... 阅读全帖
a***k
发帖数: 1038
35
来自主题: paladin版 - 红死病 by 杰克.伦敦
I
The way led along upon what had once been the embankment of a railroad. But
no train had run upon it for many years. The forest on either side swelled
up the slopes of the embankment and crested across it in a green wave of
trees and bushes. The trail was as narrow as a man's body, and was no more
than a wild-animal runway.
Occasionally, a piece of rusty iron, showing through the forest-mold,
advertised that the rail and the ties still remained. In one place, a ten-
inch tree, bursting through... 阅读全帖
d***e
发帖数: 793
36
来自主题: Database版 - 面试中的一道sql的题目。
select
Month(date),
case when WEEKDAY(date) = 0 then sales else 0 end as Mon,
case when WEEKDAY(date) = 1 then sales else 0 end as Tue,
case when WEEKDAY(date) = 2 then sales else 0 end as Wed,
case when WEEKDAY(date) = 3 then sales else 0 end as Thu,
case when WEEKDAY(date) = 4 then sales else 0 end as Fri,
case when WEEKDAY(date) = 5 then sales else 0 end as Sat,
case when WEEKDAY(date) = 6 then sales else 0 end as Sun
from table
group by 1
m******t
发帖数: 6905
37
来自主题: Database版 - 面试中的一道sql的题目。
Hi all
I created a table and tried the solution above but it failed. who can help
--Creat Table and loading data by using bulk insert
Drop Table Test20140317
Create Table Test20140317
(SalesDate date,
Sales Decimal)
Bulk insert Test20140317
from 'C:\filepath\Book1.txt'
with
(ROWTERMINATOR = '\n',
firstrow = 2)
select * from Test20140317
--Here is the above solution, I used DateName function to display week days.
select
Month(SalesDate),
case when DATENAME(WEEKDAY,(SalesDate)) = 0 then ... 阅读全帖
F*******I
发帖数: 200
38
来自主题: MedicalCareer版 - 脑死亡
“Nothing Else Matters”
https://www.youtube.com/watch?v=QohUdrgbD2k
"Nothing Else Matters"
Lucie Silvas
So close, no matter how far
Couldn't be much more from the heart
Forever trusting who we are
'Cause nothing else matters
I never opened myself this way
Life is ours, we do it our way
All these words I just don't say
'Cause nothing else matters
Never cared for what they do
Never cared for what they know
But I know
So close, no matter how far
Couldn't be much more from the heart
Forever trusting ... 阅读全帖
l*********l
发帖数: 2371
39
What type of model is this?
************************************************
Case when dist_min <4.47288
Then case when geo_pct_white is not null
Then case when geo_pct_white <78.5
Then case when home_own < 3.5 then 0.091 else 0.034 end
Else case when cac_age_cd <5.5 then 0.018 else 0.011 end
Else .006
End
Else case when geo_pct_white is not null
Then case when geo_pct_white <81.5 tehn .05 else .014 end
Else .002
End
end
b********n
发帖数: 38600
40
来自主题: Military版 - 看看美帝怎么算计大宋的
http://www.strategypage.com/htmw/htlead/articles/20120807.aspx
Can't We All Just Obey China?
China recently declared that most of the 3.5 million square kilometers South
China Sea had become Sansha, the latest Chinese city. The area China claims
is within the city limits comprises over two million square kilometers of
largely open ocean and a few hundred tiny islands and reefs, many of which
are only above water during low tide. Sansha is administered from one of the
Paracel islands (Woody Islan... 阅读全帖
s********0
发帖数: 71
41
来自主题: Military版 - 模重复平方算法
在RSA算法里头经常要用到“求x的n次方模m”这样的过程,通常使用O(log(n))的模重
复平方算法来实现,提高效率。
其实这是大二学的《信息安全数学基础》里面的内容,那时为了考试需要(手算+写出
很罗嗦的过程),还专门写了代码放在Blog空间里考试的时候用—……
同样O(log(n))的递归算法其实很容易理解:
/* C */
int fast_mod(int x, int n, int m)
{
if (n == 0)
return 1;
else if (n % 2 == 0)
return square(fast_mod(x, n / 2, m)) % m;
else
return x * fast_mod(x, n - 1, m) % m;
}
#Python
fast_mod = lambda x, n, m: 1 if n == 0 else fast_mod(x, n / 2, m) ** 2 % m
if n % 2 == 0 else x * fast_mod(x, n - 1, m) % m... 阅读全帖
r*****g
发帖数: 434
42
来自主题: Military版 - 模重复平方算法
这么学术的东东放错地方了吧

在RSA算法里头经常要用到“求x的n次方模m”这样的过程,通常使用O(log(n))的模重
复平方算法来实现,提高效率。
其实这是大二学的《信息安全数学基础》里面的内容,那时为了考试需要(手算+写出
很罗嗦的过程),还专门写了代码放在Blog空间里考试的时候用—……
同样O(log(n))的递归算法其实很容易理解:
/* C */
int fast_mod(int x, int n, int m)
{
if (n == 0)
return 1;
else if (n % 2 == 0)
return square(fast_mod(x, n / 2, m)) % m;
else
return x * fast_mod(x, n - 1, m) % m;
}
#Python
fast_mod = lambda x, n, m: 1 if n == 0 else fast_mod(x, n / 2, m) ** 2 % m
if n % 2 == 0 else x * fast_mod(x... 阅读全帖
o********t
发帖数: 1655
43
来自主题: Military版 - 这个对李博肉的评价太贴切了
The 12 Unspoken Rules For Being A Liberal
http://youngcons.com/the-12-unspoken-rules-for-being-a-liberal/
1) You justify your beliefs about yourself by your status as a liberal, not
your deeds. The most sexist liberal can think of himself as a feminist while
the greediest liberal can think of himself as generous. This is because
liberals define themselves as being compassionate, open minded, kind, pro-
science and intelligent not based on their actions or achievements, but
based on their ideolog... 阅读全帖

发帖数: 1
44
我可以看得到,copy paste将就看下吧
Image
CreditCreditPhoto illustration by Joan Wong. Photographs by Ronghui Chen for
The New York Times.
Skip to content
Skip to site index
Where Does Affirmative Action Leave Asian-Americans?
A high-profile lawsuit against Harvard is forcing students and their
families to choose sides.
CreditCreditPhoto illustration by Joan Wong. Photographs by Ronghui Chen for
The New York Times.
By Jay Caspian Kang
Photographs by Ronghui Chen
Published Aug. 28, 2019
Updated Sept. ... 阅读全帖
c*****g
发帖数: 21627
45
来自主题: USANews版 - 疣太高盛迫害前员工
Michael Lewis: Did Goldman Sachs Overstep in Criminally Charging Its Ex-
Programmer?
A month after ace programmer Sergey Aleynikov left Goldman Sachs, he was
arrested. Exactly what he’d done neither the F.B.I., which interrogated him
, nor the jury, which convicted him a year later, seemed to understand. But
Goldman had accused him of stealing computer code, and the 41-year-old
father of three was sentenced to eight years in federal prison.
Investigating Aleynikov’s case, Michael Lewis holds a s... 阅读全帖
c******i
发帖数: 4091
46
发信人: chichazi (吃叉子), 信区: USANews
标 题: 推荐一个六十年代的科幻短篇,道尽aa本质,可笑可悲可叹
发信站: BBS 未名空间站 (Sat Oct 19 14:09:30 2013, 美东)
成篇于1961,你不得不佩服少数智者对于未来的洞察力。一如1984的作者,勇敢新世界
的作者,等等
故事背景是所有高于平均智商者都要在耳朵里装上一个干扰器发出随机噪音以干扰佩戴
者的思绪,结果降低智商至平均之下。
不仅是高智商要被降低,美丽女子也必须要戴上面具,但目的是为了“平权”,俊美的
兰陵王和狄青戴上狰狞面具杀敌的故事是不会在这个乌托邦里流传了。
aa的本质就是想搞均智愚,口号是造反有理傻婢万岁。
http://www.tnellen.com/cybereng/harrison.html
HARRISON BERGERON
by Kurt Vonnegut, Jr.
THE YEAR WAS 2081, and everybody was finally equal. They weren't only equal
before God and the la... 阅读全帖
c******i
发帖数: 4091
47
成篇于1961,你不得不佩服少数智者对于未来的洞察力。一如1984的作者,勇敢新世界
的作者,等等
故事背景是所有高于平均智商者都要在耳朵里装上一个干扰器发出随机噪音以干扰佩戴
者的思绪,结果降低智商至平均之下。
不仅是高智商要被降低,美丽女子也必须要戴上面具,但目的是为了“平权”,俊美的
兰陵王和狄青戴上狰狞面具杀敌的故事是不会在这个乌托邦里流传了。
aa的本质就是想搞均智愚,口号是造反有理傻婢万岁。
http://www.tnellen.com/cybereng/harrison.html
HARRISON BERGERON
by Kurt Vonnegut, Jr.
THE YEAR WAS 2081, and everybody was finally equal. They weren't only equal
before God and the law. They were equal every which way. Nobody was smarter
than anybody else. Nobody was better looking than anybody ... 阅读全帖
l****z
发帖数: 29846
48
这个,左逼们来解释一下?
Health Reform Will Not Cut Emergency Room Visits, President Obama Hardest
Hit
One of President Obama's constant refrains during the battle over health
reform has been that expanding coverage would reduce inefficiency in the
system. In particular, he often cited expensive expensive emergency room
visits as something that reform could help reduce. But it turns out,
Obamacare, like Romneycare before it, is likely to increase emergency visits
, maybe substantially.
MIT News reports on a... 阅读全帖
F***Q
发帖数: 6599
49
来自主题: Automobile版 - 电车最大的麻烦是家里必须两辆车

I kind of exhausted all options for you. I am sure you will find something
suiting your needs (perhaps the last else block)
decision tree for using an EV as a primary car(){
if(you are ok with an PHEV){
buy a PHEV
DONE
}else if(you are ok with an BEV){
if(you have $$ to afford a Tesla) then{
buy a Tesla
DONE
}else{ // you are on a budget for a BEV
if(you have $ for rental cars){
buy a budget BEV for commute, rent a zipcar for road trips
... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)