Erdong(Roger)'s profileRoger's 流水账PhotosBlogLists Tools Help

Blog


    转载:经典算法与追MM

    转载:经典算法与追MM

     

    引用

    转载 +原创 经典算法的解释


    今天看到这篇东西
     
     
    anyway,比较有意思,而且还都是原创的...
    就贴一下吧(转载from  bamboo的space)
     
    //****************************************************
    // 以下文字由 易老大@bbs.ss.pku.edu.cn 原创

    动态规划,基本上就是说:
    你追一个MM的时候,需要对该MM身边的各闺中密友都好,这样你追MM这个问题
    就分解为对其MM朋友的问题,只有把这些问题都解决了,最终你才能追到MM。
    因此,该问题适用于聪明的MM,懂得“看一个人,不是看他如何对你,而是看
    他如何对他人。”的道理,并且对付这样的MM总能得到最优解。但确定是开销
    较大,因为每个子问题都要好好对待。。。。
     
    贪心法,基本上就是:
    你追一个MM的时候,从相识到相知,每次都采用最aggresive的方式,进攻进攻
    再进攻!从不采用迂回战术或是欲擒故纵之法!目标是以最快的速度确立两人
    关系。
    该法优点是代价小,速度快,但缺点是不是每次都能得到最优解。。。。。

    回溯算法,基本上就是:
    追一个MM,但也许你还是情窦初开的新手,不知道如何才能讨得MM的欢心,于
    是你只好一条路一条路的试,MM不开心了,你就回溯回去换另一种方式。当然
    其间你也许会从某些途径得到一些经验,能够判断哪些路径不好,会剪枝(这
    就是分支估界了)。你也可以随机选择一些路径来实施,说不定能立杆见影(
    这就是回溯的优化了)但总的来说,你都需要一场持久战。。。。
    该算法一般也能得到最优解,因为大多数MM会感动滴!!但其缺点是开销大!
    除非你是非要谈一场恋爱不可,否则不推荐使用。特别是你可能还有许多其他
    的事情要做,比如学习,比如事业。。。。

     
    NP完全问题:
    呵呵,那你为什么那么贱,非要去追呢?记住:“天涯何处无芳草!”
    不过如果你“非如此不可”的话,建议升级你的硬件,好好学习,好好工作,
    加强实力,人到中年的时候也许你能解开NP难。。。。

    //****************************************************
    //以下为 bamboo 原创
    网络流:
     
    追MM的时候总避免不了送礼物,但是你老是直接送礼物就会给MM造成很大的压力
    ,于是你就想到了通过朋友来转送的方法。你希望送给MM尽可能多的礼物,所以
    就是需要找到一中配送方案,就是最大流了。然而你请别人帮忙并不是不要开销
    的,你让A同学拿去给B同学可能需要一些花费,自然你不是一个大款,想最小化
    这个花费,那么就是最小费用最大流了……
     
    //****************************************************
    //以下下为dynamic原创
    NP:在你追了若干美女都失败告终后,你发现有一批美女追起来是一样困难的,
    如果你能追到其中任何一个就能追到其他所有的美女,你把这样的女人叫作
    NP-Complete。P=NP:这是一个美好的猜想,追美女和恐龙的难度其实一样。
    APX与Random:NP的美女难追,你无法完全占有她。你只好随机的去靠近她,
    装作若无其事;或者用一种策略,追到她的一个approximation ratio,
    例如50%。APX-hard:这样的女人,连一个固定的百分比都不给你,还是另谋高就吧。
     
     
    //****************************************************

    //最后我也随便写一点好了...

    匹配:从初中到高中到大学大家追来追去,就是个二分图匹配的过程....

    "和谐社会"应该就一个最大匹配...

    可是后来有某些MM同时跟>1个人发展,违背了匹配的基本原则...大家都很BS之...

    然后最近断背山很火,人们惊奇得发现原来还可以是 任意图匹配...

    STL:某位贝尔实验室的大牛在追了N个MM后,为了造福后来人,总结了自己的经验,
    出了本《 追MM求爱秘笈大全》,英文名叫Standard   courTing   Library,缩写为
    STL广大同学在使用STL后,惊喜地发现追MM变得异常方便,大大缩短了时间和精力...

    //****************************************************

    21 March

    coding & coding & coding

    coding occupies almost my working time recently...:)
    really a tough job, i have to enjoy coding..., enjoy coding...

    李开复眼中的北京美食

    李开复眼中的北京美食
     
    大牛就是不一样
     
    岳麓山屋 - 后海的岳麓山屋顾名思义是湖南菜,最有特色是酱椒鱼头,吃过鱼头之后,还会上很好的面条,拌在一起,微辣而鲜美。凉菜里的手撕蒜苗(蒜苔),非常清口。饮料里面,米酒很不错。
     
    下次准备一家一家去吃,哈哈..
    19 March

    The Husband Store! (zz)

    The Husband Store!


    A store that sells husbands has just opened in New
    York City, where a woman may go to choose a husband.
    Among the instructions at the entrance is a
    pescription of how the store operates. You may visit
    the store ONLY ONCE !


    There are six floors and the attributes of the men
    increase as the shopper ascends the flights. There is,
    however, a catch . . .. you may choose any man from a
    particular floor, or you may choose to go up a

    floor, but you cannot go back down except to exit the
    building! So, a woman goes to the Husband Store to
    find a husband . .


    On the first floor the sign on the door reads:

    Floor 1 - These men have jobs and love the Lord.

    The second floor sign reads:

    Floor 2 - These men have jobs, love the Lord, and love kids.

    The third floor sign reads:

    Floor 3 - These men have jobs, love the Lord, love kids, and are
    extremely good looking.

    Wow," she thinks, but feels compelled to keep going.

    She goes to the fourth floor and sign reads:

    Floor 4 - These men have jobs, love the Lord, love
    kids, are drop- dead good looking and help with the
    housework.

    Oh, mercy me!" she exclaims, "I can hardly stand it!"
    Still, she goes to the fifth floor and sign reads:

    Floor 5 - These men have jobs, love the Lord, love
    kids, are drop- dead gorgeous, help with the
    housework, and have a strong romantic streak.

    She is so tempted to stay, but she goes to the sixth
    floor and the sign reads:

    Floor 6 - You are visitor 4,363,012 to this floor.
    There are no men on this floor. This floor exists
    solely as proof that women are impossible to please.

    Thank you for shopping at the Husband Store. Watch
    your step as you exit the building, and have a nice day!

    Please send this to all men for a good laugh and to all the
    women who can handle the truth!

    17 March

    安全知识(zz)

    安全知识


     1、《北京 7 台》的节目披露


     l         有一妇女手提包被偷,里面有手机、银行卡、钱包等。


     l         20分钟后,当她打电话告诉老公被偷的事,老公惊呼:啊,我刚才收到你
     的短信问咱家卡的密码,我立马就回了!


     l         赶到银行时已被告知里面所有的钱都已被提走。


     l         小偷通过用偷来的手机发送短信给 "亲爱的老公 " 而获取了密码,然后
     在短短20分钟内把钱取走了。


     教训:


     l         不要在手机通讯录暴露本人与联系人的关系,忌用 "家" 、" 老公"、 "
     爸 " 、" 妈" 等定义联系人。


     2、一个您不能不知道的 , 112专线


     日前有三位护士不慎连人带车跌落一百五十公尺深的山谷,于受困四日三夜后始获
     救。其间,她们曾尝试以手机向外求救;无奈一支摔坏,一支无电,一支收讯不良。


     她们亦曾移动位置以寻找较佳的收讯处,但都未能成功。如果这三位护士平常就知道
     112专线,紧急时刻也能记得以那支即使收讯不良的手机拨出112专线,相信她
     们应可很快地获救。


     全国各地通用的112专线,在手机打开后即使没有接收讯号,甚至电力极为微弱,
     任何厂牌的手机在任何地点皆可拨通。拨出112后,马上会进入语音说明如下 ∶这
     里是行动电话112紧急救难专线,如果您要报案,请拨 0,我们将会为您转接警察
     局;如果您需要救助,请拨9,我们将会为您转接消防局。中文讲完后,会以英文重
     述一遍。此时只要拨0或9,一定会有人接听。以三位护士所处的情况,或登山迷途
     与山难时,应拨9,将可获得即时的救助。


     为测试此项功能,本人曾数次至偏远深山等收讯不良处实地测试,结果是百试皆灵。
     希望全国每个人都能知到112这项手机功能,也希望每个人能尽量与大家分享,周
     遭如有外国朋友也应告知他们。并且每个人应实地至荒郊野外测试三次以上,以增加
     印象与记忆力。我相信如果这三位护士于发生灾难当时知道这项功能,应可不至于受
     困三夜始被救出。


     3、不要直接用碗面、杯面所附的容器


     请大家注意身体, 爱吃方便面的一定要看 , 不要直接用碗面、杯面所附的容器食
     用。


     文章所说的是写这封信的这个人的同事的侄子在英国念书大约一年半,


     而这位侄子呢,他喜欢吃杯面的速食面。结果猜怎么着?


     这位侄子的医生发现他的胃壁附着一层蜡!


     因为,杯面的容器里包含一种可食用的蜡!


     各位下次吃杯面的时候摸摸看杯壁是不是觉得滑滑的,那就是了,


     而长时间的食用杯面后造成我们的肝脏无法分解这种毒,


     最后这位侄子也就在寻求手术治疗移除这层蜡时死了。


     所以各位以后吃泡面的时候,尽量把面拿出来


     另外用自己的碗来泡,不要直接用碗面、杯面所附的容器食用。


     为了自己的身体,不要偷懒啊!知道吗 ??
    16 March

    about web services

     

    AJAX结合wiki与试算表 (zz)

    若要找人把维基百科(wikis)和试算表这两种似乎风马牛不相及的技术整合起来,那么请VisiCalc发明人Dan Bricklin来操刀准没错。

    http://searchwebservices.techtarget.com.cn/174/2312674.shtml

     

    it's really a cool tool, i guess maybe better than EXCEL, it's free. But Office Live definitely will consider how to improve the online functions of EXCEL:)

    http://www.softwaregarden.com/wkcalpha/installwikicalcwin.html (you can download it here)

    著名IT公司名字来由(zz)

    zz from yaodong's blog

    i got some spirits about the name of my company in the future, haha, maybe "Erdong", haha, it seems that it's both easier to pronounce in Chinese and English. haha:)

     

    著名IT公司名字来由

    Yahoo!

    《格列佛游记》的作者Jonathan Swift发明了yahoo这个单词。在小说里,它代表了一个在外表和行为举止上都令人厌恶的家伙,简直都不能算是一个人。Yahoo! 的创始人杨致远和David Filo选择这个名字的原因是他们觉得自己是yahoo。

    点击图片看原样大小图片





    另一种说法,Yahoo是Yet Another Hierarchical Officious Oracle的首字母缩写,不过David Filo和杨致远坚持他们选择这个名称的原因是他们喜欢字典里对yahoo的定义:“粗鲁,不通世故,粗俗。” (来源:

    http://docs.yahoo.com/info/misc/history.html)

    点击图片看原样大小图片





    Xerox

    xer是希腊文字根,代表“干”。由于Chestor Carlson发明的产品是干式复印,和当时占优势的湿法复印有显著的差别,所以他用Xerox命名。

    点击图片看原样大小图片





    这个大家见多了吧!HOHO~   

    SUN Microsystems

    由斯坦福大学的四个家伙创建。SUN 是“Stanford University Network”的首字母缩写。

    点击图片看原样大小图片





    Sony

    来自sonus和sonny的组合。sonus是拉丁词,代表声音。sonny是美国俚语,用来称呼聪明伶俐的少年。

    点击图片看原样大小图片





    SAP   

    代表Systems, Applications, Products in Data Processing。四个IBM的前雇员组建了SAP。他们为IBM工作时属于的团队叫“Systems/Applications/Projects”。   

    Red Hat   

    公司创始人Marc Ewing念大学的时候,他祖父给了他一顶康奈尔曲棍球队的帽子。帽子上有着红色和白色的条纹。他不小心把帽子弄丢了,不得不拼命去找。红帽子Linux beta版的用户手册里面有一段话,央求用户如果找到了他的红帽子,请归还!

    点击图片看原样大小图片





    Oracle   

    Larry Ellison 和 Bob Oats 曾经为中央情报局的一个咨询项目工作。这个项目的代号就叫 Oracle。

    点击图片看原样大小图片





    点击图片看原样大小图片





     

    Motorola   

    创始人Paul Galvin是在公司开始生产车用无线电的时候让公司叫现在这个名字的。原先它叫Victrola。

    点击图片看原样大小图片





    Microsoft   

    Bill Gate起了这个名字。为了代表MICROcomputer SOFTware,就叫做Micro-Soft,后来把中间的 “-” 去掉了。

    点击图片看原样大小图片





    Lotus   

    从莲花式盘坐(padmasana)中得名。创始人Mitch Kapor 曾经是Maharishi Mahesh Yogi的超脱静坐教师。

    点击图片看原样大小图片





     

    Intel   

    Bob Noyce和Gordon Moore想把他们的公司命名为“Moore Noyce”,可是这个名字已经为一家连锁旅馆注册了。Intel是INTegrated ELectronics的缩写

    点击图片看原样大小图片





    今后不会有新的 intel inside

    Hewlett-Packard

    点击图片看原样大小图片





    Bill Hewlett和Dave Packard丢硬币来决定他们的公司叫Hewlett-Packard还是Packard-Hewlett。  

    点击图片看原样大小图片





     

    Hotmail   

    创始人Jack Smith想出了最初的主意,要建立一种任何计算机都可以通过网络访问的电子邮件网络服务。当Sabeer Bhatia参与起草商业计划书的时候,他尝试了各种以mail结尾的名字。最后,他选择了Hotmail。因为Hotmail包含了html。Hotmail最早的形式是HoTMaiL。   

    点击图片看原样大小图片





    Google   

    名字来自于一个关于搜索引擎到底能搜索多少信息的玩笑。最早它叫“Googol”,代表1后面跟100个0。创始人Sergey Brin和Larry Page曾经向一位天使投资人演示他们的项目,最后他们收到了一张给“Google”公司的支票!  

    点击图片看原样大小图片





    赞啊~

    Cisco   

    San Francisco的最后五个字母。公司的徽标就是三藩市的金门大桥。

    点击图片看原样大小图片





    Apple Computers   

    Steve Jobs最喜欢的水果。他本该早就为公司申请一个名字,可是三个月过去了,还没有注册。Jobs威胁大家,如果五点钟之前还找不到一个比“苹果电脑”更好的名字,那么公司就叫“苹果电脑”了。

    点击图片看原样大小图片





    Apache   

    创始人是从给NCSA httpd后台代码打补丁起步的。结果,他们得到了“A PAtCHy” server(打过补丁的服务器),于是,就叫Apache了。

    Apache是世界使用排名第一的Web服务器。呵呵,这个也叫APACHE

    点击图片看原样大小图片





    Adobe   

    创始人 John Warnock家后面有一条叫做Adobe Creek的河。

    点击图片看原样大小图片





    PS大家肯定都知道啦

    10 March

    Outsourcing: Silicon Valley East

    zz自Newsweek,这个应该不算侵权吧,如果算的话,我就删掉

    Outsourcing: Silicon Valley East


    NEWSWEEK International Editor Fareed Zakaria joined us for a Live Talk about India’s growing power in the world, on Thursday, March 2, at 12:30 p.m. ET. 
    By Keith Naughton
    Newsweek

    March 6, 2006 issue - During the height of the dot-com boom, Dan Scheinman was one of Silicon Valley's most popular tech execs. As the chief of mergers and acquisitions for Cisco Systems, he couldn't go to a party without being besieged by entrepreneurs eager to sell their business to the deep-pocketed tech giant. Now Scheinman is once again the toast of dinner parties, but he's being pitched on new properties over tandoori chicken and Darjeeling tea in Bangalore. For Cisco, India is the new frontier, where it's investing $1.2 billion to build a gleaming R&D campus that will employ 3,000 people. "Bangalore feels like the center of the technology world," says Scheinman. "There's a level of chaos, energy and a sense that anything is possible."


    Not long ago, what seemed most possible was that India would steal the jobs of American workers. But as George W. Bush visits there this week, he'll find a maturing economy that is no longer all about call centers and basic tech support. Now big American investment banks and drugmakers are joining tech firms on the passage to India. R&D centers are springing up so fast that there's now a shortage of Indian engineers. And the stigma of outsourcing jobs to India is disappearing. American companies once afraid to put their names on the doors of their Indian offices now issue press releases touting their latest investments there. "American firms have gotten over their anxiety about India," says financial-services consultant Harrell Smith of Celent Communications. "Now the new anxiety is if you're not in India."

    What happened to the outsourcing backlash? It has been muted by the fact that India didn't suck Silicon Valley dry after all. Actually, U.S. tech employment is growing. There are 17 percent more tech workers in the United States today than back in the bubble days of 1999, says a new study by the Association for Computing Machinery. And the Bureau of Labor Statistics predicts that the U.S. economy will add 1 million tech jobs over the next decade, a 30 percent increase. "Everyone was worried about the offshoring bogeyman," says Moshe Vardi, an author of the ACM study. "But the big whoosh of jobs to India never happened.'' Indeed, that gush slowed to a steady stream once American companies realized it's tough to set up shop in a country with bad roads and a patchy power grid. Lately, American consulting firms that once predicted runaway growth in outsourcing to India have been slashing their estimates by half or more. Now American companies are hanging on to the high-skilled work that requires face-to-face interaction, while everything that can be done "over the wire" gets shipped offshore.

    India remains the No. 1 destination for that work for a growing number of American industries. With cost pressures never greater on American business, India's rock-bottom wages just can't be ignored (not to mention its well-educated work force that speaks English). The average annual income in India is just $737, versus $42,027 in the United States. Even a college-educated Indian worker earns one fifth what his American counterpart does. And he's willing to put in 12-hour days, six days a week. That's why U.S. companies are expected to employ more than 1.5 million service workers in India by 2008, a threefold increase from today, according to McKinsey & Co. "When India was the new trend, companies had a gold-rush mentality," says Global Insight chief economist Nariman Behravesh. "Now companies are taking a more mature, sober attitude." Just like the Indian economy itself.

    With Brad Stone

    03 March

    my major

    You scored as Theater. You should be a Theater major! Like a bohemian actress, you are seasoned and confident and not afraid to express yourself!

    Theater

    100%

    Sociology

    100%

    Mathematics

    92%

    Engineering

    92%

    Philosophy

    83%

    Linguistics

    58%

    Journalism

    58%

    Psychology

    58%

    Art

    58%

    Anthropology

    42%

    Chemistry

    33%

    Dance

    33%

    English

    25%

    Biology

    25%

    What is your Perfect Major? (PLEASE RATE ME!!<3)
    created with QuizFarm.com
    09 February

    新年第二贴

    哈哈,回家都已经2周了。。。除了改了两篇论文和体检,还有小学,初中,高中的若干次聚会,其他事情都没有做!!!
    自己太懒了...,要开始工作了...
     
    希望大家offer多多...
    07 February

    Your brain is a healthy mix of male and female

    Your Brain is 53.33% Female, 46.67% Male
    Your brain is a healthy mix of male and female You are both sensitive and savvy Rational and reasonable, you tend to keep level headed But you also tend to wear your heart on your sleeve
    17 January

    you should learn chinese

    You Should Learn Chinese
    Surprised? You shouldn't be - Chinese is perfect for an ambitious person like you. You're a natural entrepreneur, and a billion people are waiting to do business with you!
    看来我爸妈没有把我生错地方...