Dec 15

从小老师就教导我们,不会做的题就选C,因为选择题选C的概率是最高的。事实上真是如此吗?今天我突发奇想,利用Google做了一个小实验。统计显示,答案选C的题果然是最多的!

Results 1 - 10 of about 364,000 for "这道题选A".
Results 1 - 10 of about 352,000 for "这道题选B".
Results 1 - 10 of about 521,000 for "这道题选C".
Results 1 - 10 of about 254,000 for "这道题选D".

Results 1 - 10 of about 2,140 for "这道题为什么选A".
Results 1 - 10 of about 2,200 for "这道题为什么选B".
Results 1 - 10 of about 2,580 for "这道题为什么选C".
Results 1 - 10 of about 1,350 for "这道题为什么选D".

Sep 22
Google在MIT发布的难题
icon1 Matrix67 |icon2 Brain Storm | icon4 2009-09-22 12:08 | icon329 Comments »

刚从cnPhil那儿看到一则有趣的消息:近日,Google Jobs在MIT校园内到处张贴着一份密码,企图在MIT校园里的一群变态中找出几个最变态的破密大牛。密码上面附文说,如果你能破解这份密码,你在Google会很有前途。据说,这份密码包含了一个Google Jobs的电话号码,解开密码的人可以通过此电话留下自己的个人信息。目前,还没有人破解出这段密码来。

查看更多 »

May 24

    一个迟到的消息:Google Treasure Hunt 2008已经开始了,这是Google Sydney为了挖掘出新的工程师而精心设置的一个活动。现在已经有两道题目了,在以后几周的时间里Google将陆陆续续地发布更多的题目。第一个答对所有问题的人将成为这次Treasure Hunt的获胜者。
    有兴趣的朋友赶快去试一试。

Dec 18

    Ben orenstein尝试在Goolge Code Search里输入脏话,在众多的开源软件中找到了一些非常牛B的代码:

gdb-6.4.50.20060515:
/* OK, now set up the filehdr...  */

/*   We will NOT put a fucking timestamp in the header here. Every time you
     put it back, I will come in and take it out again.  I’m sorry.  This
     field does not belong here.  We fill it with a 0 so it compares the
     same but is not a reasonable time. — gnu@cygnus.com  */


Siesta-0.66:
    # This job would be great if it wasn’t for the fucking customers.

CGI-FormBuilder-3.0202:
        # Get field from radio buttons or checkboxes
        # Must cycle through all again to see which is checked. yeesh.
        # However, this only works if there are MULTIPLE checkboxes!
        # The fucking JS DOM *changes* based on one or multiple boxes!?!?!
        # Damn damn damn I hate the JavaScript DOM so damn much!!!!!!


DJabberd-0.81:
    # Trillian, again, is fucking stupid and crashes on just
    # about anything its homemade XML parser doesn’t like.


gift-0.11.5:
void list_lock_insert_sorted (ListLock *lock, CompareFunc func, void *data)
{
    if (lock->locked)
    {
        /* TODO: this is obviously not right ... this whole fucking module
         * sucks anyway */
        list_lock_prepend (lock, data);
        return;
    }

    lock->list = list_insert_sorted (lock->list, func, data);
}


bh-asia-03-grugq:
    /* if we get here, there are massive fucking problems, for a start
     * our stack is fucked up, and we can’t return(). Just crash out. */


trunk:
    /* FIXME: please god, when will the hurting stop? Thus function is so
              fucking broken it’s not even funny. */


SQL-Abstract-1.20:
    # Note to self: I have no idea what this does anymore
    # It looks like a cool fucking segment of code though!
    # I just wish I remembered writing it… :-\


mendax_linux:
for(i = 0 ; i < pktcount; i++) {
    from.sin_port = htons(ntohs(from.sin_port) + 1);
    pktlen = gen_tcp_pak(&pak, &from, dst, ip_id++,
                     seq_num, 0L, 0, flags);
    seq_num += 64000;

    /* don't fire dem packets too fucking fast */
    usleep(1000);

    send_pak((char *) &pak, pktlen, ether);
    putchar('.');
}


SugarOS-for-Microsoft-Full-4.5.0h:
    /*   Outlook can’t fucking follow RFC if someone PAID them to do it…
        oh wait, someone paid them NOT to do it. */


AfterStep-2.2.5:
    /* No we fucking don’t! DB entries should be stored in the same order
       as they are in the file ! I can’t belive I was so fucking stupid !  */


gallery-2.0.4/modules/core/classes/GalleryStorage:
else if ($affectedRows > 1) {
   /* Holy shit, we just updated more than one row!  What do we do now? */
   return GalleryStatus::error(ERROR_STORAGE_FAILURE, __FILE__, __LINE__,
                        "$query (" . implode('|', $data) . ") $affectedRows");
}


linux-2.4.34.1/arch/sparc/lib/checksum.S:
        /* Sun, you just can’t beat me, you just can’t.  Stop trying,
         * give up.  I’m serious, I am going to kick the living shit
         * out of you, game over, lights out. */


linux-2.6.1/arch/mips/kernel/sysirix.c:
    /* 2,191 lines of complete and utter shit coming up… */

nfs-utils-1.1.0/utils/statd/misc.c:
    if (!(ptr = malloc (size)))
            /* SHIT!  SHIT!  SHIT! */
            die (”malloc failed”);


dada-2_10_12:
    # code below replaces code above - any problems?
    # yeah, it doesn’t fucking work.

Nov 7

    这个可能比较火星,很多人可能已经知道了这个彩蛋;但如果你事先不知道这个彩蛋而碰巧遇上了,你能找出触发这个彩蛋的条件吗?刚才打开iGoogle,发现一件神奇的事件:我的iGoogle主题的顶部图片上居然出现了一个圆周率π──天上的星星排列出来的形状。我立即想到这是iGoogle的一个彩蛋,但我却不知道是什么东西触发了这个彩蛋。仔细想了一下后,突然恍然大悟,这个触发条件确实符合Google的Geek精神。把当时的截屏放出来给大家看一看,如果你还不曾听说过这个彩蛋,你完全可以通过这个截屏找出这个彩蛋的触发条件。继续看下去前不妨先来找找看~~


































    图上显示截屏的时间是11点15分。中国是东八区,比标准时间早8小时,因此国际标准时间是3点15分。考虑到本机时间准确性、截屏时间稍晚等原因,很容易想到iGoogle页面的实际生成时间是3点14分。也就是说,当国际标准时间恰为3:14时,iGoogle将会出现彩蛋。

图片地址:http://www.google.com/ig/images/skins/sweetdreams/3.14am/header_bg.jpg
了解更多:http://www.gseeker.com/50226711/googleaeaeeceee_66197.php

Oct 22

看看下面两道题,它的解答非常简单,即使没学过信息学的人也可以想到答案。你能在多短的时间内想出问题的算法来?一小时?一分钟?一秒钟?

1. 给你一个长度为N的链表。N很大,但你不知道N有多大。你的任务是从这N个元素中随机取出k个元素。你只能遍历这个链表一次。你的算法必须保证取出的元素恰好有k个,且它们是完全随机的(出现概率均等)。

2. 给你一个数组A[1..n],请你在O(n)的时间里构造一个新的数组B[1..n],使得B[i]=A[1]*A[2]*...*A[n]/A[i]。你不能使用除法运算。

Solution:
1. 遍历链表,给每个元素赋一个0到1之间的随机数作为权重(像Treap一样),最后取出权重最大的k个元素。你可以用一个堆来维护当前最大的k个数。
2. 从前往后扫一遍,然后从后往前再扫一遍。也就是说,线性时间构造两个新数组,P[i]=A[1]*A[2]*...*A[i],Q[i]=A[n]*A[n-1]*...*A[i]。于是,B[i]=P[i-1]*Q[i+1]。


突然想到,给别人(MM?)介绍信息学时,用这两道题当例子挺合适的。

Oct 1

今天看Google分析时发现了一件和上次相比更加不可思议的事情。

Jun 22


今天早上登陆Google分析,发现昨天的网站点击来源里居然有这么一项……
有没有人能解释一下这是为什么?

« 更早的日志