Google Code Jam 2011 (Qualification)


1. [84%/98%] Bob Trust: 两个机器人并行依次按钮


2. [87%/82%] Magicka:依次合并或者清除元素


3. [90%/85%] Candy Splitting:加法改异或


4. [58%/97%] GoroSort:概率排序

The second line of each test case will contain a permutation of the N smallest positive integers.


这题最挨打的,就是那个%.6lf。 我是用整数表示,然后后面加6个0。这个实在太误导了,让人以为会计算很复杂的概率。

PS 最后,这次的GCJ Command Line Tool还蛮好用的,呵呵~

GCJ 2011 Qualification Round Solution Download



之前给这位Richard Sears发了一封信,称赞了一下他做的事情,建议他在捐助页面,加入支付宝的支持。信是英文的,今天收到的回信,居然是中文的,不愧是“汉字叔叔”,呵呵~


很抱歉这么久才回复你。 每天大量的问题需要解决, 资料的补充, 大量的EMAIL需要回复。
我刚刚获得一个支付宝的帐户和签约同支付宝公司, 我正在将支付宝的接口安装到我的网站, 很快就会完成, 这样就很方便那些愿意赞助我的中国朋友。



Poem forwarded by Duo Liang Lin to his couple of friends

What do you really want from us?
By Anonymous

When we were the Sick Man of Asia, We were called The Yellow Peril.
When we are billed to be the next Superpower, we are called The Threat.
When we closed our doors, you smuggled drugs to open markets.
When we embrace Free Trade, You blame us for taking away your jobs.
When we were falling apart, You marched in your troops and wanted your fair share.
When we tried to put the broken pieces back together again, Free Tibet
you screamed, It Was an Invasion!
When tried Communism, you hated us for being Communist.
When we embrace Capitalism, you hate us for being Capitalist.
When we have a billion people, you said we were destroying the planet.
When we tried limiting our numbers, you said we abused human rights.
When we were poor, you thought we were dogs.
When we loan you cash, you blame us for your national debts.
When we build our industries, you call us Polluters.
When we sell you goods, you blame us for global warming.
When we buy oil, you call it exploitation and genocide.
When you go to war for oil, you call it liberation.
When we were lost in chaos and rampage, you demanded rules of law.
When we uphold law and order against violence, you call it violating human rights.
When we were silent, you said you wanted us to have free speech.
When we are silent no more, you say we are brainwashed-xenophobics.
Why do you hate us so much, we asked.
No, you answered, we don’t hate you.
We don’t hate you either, But, do you understand us?
Of course we do, you said,We have AFP, CNN and BBC’s…
What do you really want from us?
Think hard first, then answer… Because you only get so many chances.
Enough is Enough, Enough Hypocrisy for This One World.
We want One World, One Dream, and Peace on Earth.
This Big Blue Earth is Big Enough for all of Us.

============= Interesting Response =============

Echoing the Voice of the Voiceless
By Ann Lau

When Empress Dowager paid indemnity to the eight nations, the U.S. used it for the first Chinese students to study abroad.
When Sun Yat Sen came to the U.S. as a fugitive, the U.S. opened her arms.
When China was invaded by Imperial Japan, the U.S. sent in the Flying Tigers.
When China put up the bamboo curtain, the Chinese risked the shark infected sea to escape to Hong Kong and then to the west.
When the Dalai Lama called Mao as his Big Brother, it was not enough; religion is the opium of the people.
With Communism, the Chinese suffered the greatest famine in the history of mankind.
Again, the west welcomed those refugees.
When China was facing economic collapse, it was those Chinese who left China who first went back to establish commerce.
When China needed investments, the IMF came to its aid.
With Capitalism, corruption went rampant and the Chinese floating migrants became second class citizens in their own cities.
With a billion people, China has great potential; why is their government afraid of them?
Tell me why blind legal expert Chen Guangcheng was sentenced to jail when he helped villagers to file class action against forced abortion and sterilization?
Tell me why Wu Lihong, a farmer who became an environmentalist, was sentenced to jail when he tried to save Lake Tai?
Tell me why farmer Jiang Jinzhu called on outside China to help when his land and mushroom farm was illegally torn down?
Tell me why Hu Jia was sentenced to three and half years in jail when he wrote an article on the internet?
Tell me why attorney Teng Biao was kidnapped when he tried to help Hu Jia?
Tell me why Baixing’s editor-in-chief, Huang Liangtian was fired when he reported too many stories on corruption and official land grabs?
Tell me why Zeng Jinyan is in house arrest with her baby when she only blogged on the environment and AIDS?
Tell me why the petitioners in Beijing crowd around the western press and beg them to listen to their stories?
With their own fellow citizens unjustly treated, where is the outrage?
Tell me what top Chinese intellectuals said in their open letter on the Olympics and why they send their letter to the west?
Tell me what top Chinese intellectuals said in their open letter on the Tibet issue and why they send their letter to the west?
Why do Chinese in China call on the west to highlight their injustice?
Why do Chinese in China want the western press to report on their grievances?
Why do Chinese in China even went in front of the U.S. embassy to bring attention to their plights?
Could it be that their own government is not listening?
The west can turn a blind eye and close their ears to those Chinese people who pleaded for their help just as their own government have done.
There is little the west can do except to merely echo the voice of the voiceless.
If we even refuse to do that, then what kind of people are we?

Merry Christmas


送上一首我最喜爱的圣诞歌曲 – Silent Night by Billy Gilman,聊表心意… 圣诞快乐!

Silent Night


Silent night, holy night
All is calm, all is bright
Round yon virgin mother and child
Holy infant so tender and mild
Sleep in heavenly peace
Sleep in heavenly peace
Silent night, holy night
Son of God, love’s pure light
Radiant beams from thy holy face
With the dawn of redeeming grace
Christ, the Savior is born
Christ, the Savior is born
Christ, the Savior is born

CIFM China Alpha




CIFM China Alpha
CIFM China Alpha


PS:  BeautifulSoup的作者对于他这个咚咚的兴趣已然失去,所以目前为止,Python 3的HTML Parser + Tree Walker还有待新兴之星。下面这个脚本只是临时自用而已,很瓜的用正则析数据…

Python 脚本

What’s wrong with BuzzCounter?

在自己的Blog上展示Buzz,以前一直用的BuzzCounter提供的服务,但BuzzCounter最近开始出问题, 始终显示很老的buzz,不能更新,加之他本来有的一些其他的问题,比如:1. 有广告贴;2. 贴子是通过他服务器中转的,而不是从客户浏览器直接去Google取的。

再加上Google Buzz API现在也RESTful了,更好的是,还支持JSONP,跨域的问题也解决了,所以还是觉得自己写一个比较好。

参见侧边栏和附件,Google ID在buzz.js里的第一行就可以设置。至于颜色、外观啥的,自己改改buzz.css吧。


附件:aXqd Buzz