ACRush Topcoder问答语录
FameofLight ACRush: Finally the god of programming arrives
FameofLight ACRush: do you follow a random practice , or you practice question by topic , in your early days
ACRush FameofLight: No, our team practiced 3 or 4 full contests a week.
pt1989 ACRush: Can u tell us whom or what do u credit for ur success?
ACRush pt1989: I think more practice is the way.
ktuan ACRush: how can you arrange your study with 3-4 contests a week ?
ACRush ktuan: UVA, SGU , ZJU and PKU is enough.
pt1989 ACRush: what is ur method of practising? random or organised?
ACRush pt1989: contest env. We always solve programs in contest env.
Sunny_05 ACRush: wat is ur daily routine ?? i mean hw do u practice everyday ??
ACRush Sunny_05: We only have weekly routine for practice.
binarywithme ACRush: what u think about world final problems..level of difficulty
ACRush binarywithme: A little harder than 1000p.
MB__ ACRush: Which of these do you do after you submit your solution on TC: test solution, re-read problem statement, check code line by line
ACRush MB__: test for at least 10 cases.
martins256 ACRush: how many problems have you solved on OJ ?
ACRush martins256: about 2000.
kcm1700 ACRush: How many problems have you proposed on OJ or anything like this competition or something...?
ACRush kcm1700: about 2000.
vijay_comc ACRush: Who is your Arch Rival in Programming ? ;)
ACRush vijay_comc: Petr, I think.
SomethingWrong ACRush: What is your favourite Online Judge? :)
ACRush SomethingWrong: SGU.
vexorian ACRush: Why SGU?
ACRush vexorian: More tricky testcases.
Dee2306 ACRush: Being one of top programmers, do u believe its just practice which makes u perfect.. or some of u are born genius ?? :)
ACRush Dee2306: It's at least 80% due to practice
stormsky ACRush: how to practice ACM for a ACM beginner?
ACRush stormsky: practice in contest env.
piva ACRush: Do you train more of one category of problems? Or you just solve problems at random?
ACRush piva: I do more practice in the ones I have troubles with.
pt1989 ACRush: what are ur interests other than programming?
ACRush pt1989: WarCraft.
vijay_comc ACRush: Petr is already married. No plans to compete him in that area ? :D
ACRush vijay_comc: ....not yet.
Sarkin ACRush: Is analyzing algorithms an essential part of learning algorithms?
ACRush Sarkin: Not all, I think coding is in practice room is the rest way.
abdessamad ACRush: can believe it! when i see your challengers :D :D
ACRush abdessamad: It's one thing that Petr did much better than me.
stjepan ACRush: where did/do you practice most and how?
ACRush stjepan: And join contest.
binarywithme ACRush: why u choose c++ as a default programming language
ACRush binarywithme: er.. Stl is the first reason. Another one may be efficient.
geekru2 ACRush: during contest, what kind of problems do u enjoy doing? as in type of problem?
ACRush geekru2: dp and network-flow.
reginachris ACRush: What's the best OJ to start with for practice (UVa, SPOJ, TC, etc.)?
ACRush reginachris: USACO
ferry ACRush: What do you do when you can't solve a problem or you don't know what's wrong?
ACRush ferry: I will try to pass it in practice room. I always do that.
geekru2 ACRush: Do you solve puzzles and mind bending questions to improve your problem solving techniques?
ACRush geekru2: no. I don't like such problems like suduko.
Sarkin ACRush: What algorithm types helped you in the IOI?
ACRush Sarkin: dp.
abdessamad ACRush: did you like chess?
ACRush abdessamad: yes.
geekru2 ACRush: when in a team event(IOI etc), do you dominate while programming?
ACRush geekru2: yes. I guess.
kcm1700 ACRush: how do you prepare data for the challenge phase?
ACRush kcm1700: The trickiest one, of course.
binarywithme ACRush: sir what is the best way to learn DP.
ACRush binarywithme: TC contest.
[dasha] ACRush: When u were beginning to compete,did u have any problems? Like low speed of sloving, or maybe some particular method u couldn't understend for a long time, sth else? If yes, how did u get over that?
ACRush [dasha]: USACO is a really good place. Especially for the beginners.
frank44 ACRush: how long did the usaco practice take you?
ACRush frank44: half one year.
binarywithme ACRush: what u think math should b strong to become a Gud programmer
ACRush binarywithme: The mathematical foundation is helps.
khanhptnk ACRush: excuse me, do you think what we should prepare before an important contest ?
ACRush khanhptnk: relax, and rush some simple problems. And solve some problems in a contest env. is also helpful.
Sarkin ACRush: Do you recommned reading "Introduction to Algorithms"? if you know?
ACRush Sarkin: Really good.
coder29 ACRush: which parts do u advice to read in "Introduction to Algorithms"?
ACRush coder29: All parts are perfect. except complexity.
MB__ ACRush: do you do any sports but topcoding?
ACRush MB__: soccer.
vijay_comc ACRush: Complexity in CLRS is flawed ?? :o
ACRush vijay_comc: 7-8
Sarkin ACRush: What do you mean except comlexity?
ACRush Sarkin: That's only my opinion.
pcaldeira ACRush: which skill do you consider most important on TCHS/ioi-style contests?
ACRush pcaldeira: algorithm skills and coding ability.
coder29 ACRush: I am newbie...which OJ is better fr me...USCO or UVA?
ACRush coder29: USACO
hakami ACRush: Are you useing library or typing from first for SRMs?
ACRush hakami: some includes and basic untilities.
vrajesh1989 ACRush: Will you try to prove your algorithms to yourselves during contest time or just believe your intuition and start coding?
ACRush vrajesh1989: Yes, it's very important for me.
Sarkin ACRush: Do you use algorithm analyzis when solving a problem to see it's effeciency?
ACRush Sarkin: Yes. the effeciency sometimes is more important than correctness in TC contest.
coder29 ACRush: basically i want 2 to do pratice on DP and greedy types...is TCs' room are sufficient..?
ACRush coder29: A bulk of dp tasks in SRMs. TC's room is good.
rajeshsr ACRush: In short, what is the strategy for becoming a good coder, according to u?
ACRush rajeshsr: Practice is the way.
Lingmum ACRush: How can we improve our speed of solving the problems,more problems?
ACRush Lingmum: More practice.
stormsky ACRush: do you often practice TC?and how to practice?
ACRush stormsky: Yes. But in fact, I prefer to doing past Regionals and finals.
sahiltiwari ACRush: how many hours you practise per day ?
ACRush sahiltiwari: 4-5
MohammadReza ACRush: What do you do to make your code becomes bugfree although the big size?
ACRush MohammadReza: test more tricky cases.(corner cases)
rajeshsr ACRush: Sorry to be repetitious, But I want to know what is the strategy of practice you employed? U select some random problems from OJs and solve or try to master a particular domain like DP by solving problems based on that or any other thing?
ACRush rajeshsr: set problems of past regionals and finals.
puneetkp444 ACRush: Can you suggest some ways to improve problem solving abilities
ACRush puneetkp444: practice all kinds of problems.
alft7 ACRush: what do you usually do before a very important competition, practise or something else?
ACRush alft7: practice until 3 days before it.
ferry ACRush: What is the hardest problem you've done?
ACRush ferry: I in WF2007.
《程序员应该知道的97件事》读书笔记
英文:o'reilly
中文:博文视点 电子工业出版社
定价:45元,太贵,适合于从图书馆借来,每天睡觉前看一会儿。。。
下面是我的读书笔记,《短文标题,小标题》:
Beauty is in simplicity
1.阅读公认专家的编码
2.使用更短的方法 5-10行也不算极端
before your Refactor
1.起点是:清理已有的基础代码和基于这些代码写的测试
2.避开重写的诱惑(重新测试麻烦)
3.逐步增加小功能
4.新技术不是重构的理由
coding with reason
1.变量最小作用域
2.空行分割
3.需要内嵌的代码-》封装成函数
4.函数要短,古老的24行限制依然有用
5.函数参数四个以内(相关参数组合成局部对象)
6.封装且接口要窄
7.setter尽量少用
continuous learning
1.杂志、博客、微博
2.亲自编写
3.导师(最厉害的家伙)
4.看源码学习
5.午餐学习会、用户组、小范围讨论会(给别人讲授将会大大激发学习热情)
6.加入技术小组
7.参加讨论会,获得网上免费资料
8.使用播客,打发路上时间
9.《the pragmatic programmer》
do lot of deliberate practise
rt
未完待续。。。
无意中发现的UVA 数据生成系统
课程设计那点事
今天恰巧错过CF,稍微用点时间扯扯我一直想写的文章《课程设计那点事》。
提笔的一瞬,突然不想扯废话了,那就我用我的“简洁”来叙述吧。
有了自信,就有了一切。————题记
从大一下C++说起。
//《无与伦比的美丽》
我一开始还是蛮有抱负的,重金买了C++primer,每天都看一些,每次下课之后都会围在老师严悍
身边问若干问题,可是,不知道哪一天,我就坚持不下来了,C++primer开始接受灰尘的洗礼,甚
至教材也不看了,课也翘了,上机作业也完不成了。
//《披着羊皮的狼》
于是,面对对象那一块我一点都不会了,甚至到现在我依然对虚基类等概念一无所知(现在是不想
知道),于是,我的C++就这么华丽丽地悲剧了。期末考试时,我觉得写个汽车类是世界上最难理
解的东西,考前刚背的都忘了。。。
然后,大二上开始了C++课程设计。
这中间还想插一段南理工校赛的事情,但是我发现我到现在还没有进入主题,罢了,那一段的结尾
是“决赛0题收场,又一次打击”。
//《倾国倾城》
C++课设两部分,一个人的做的那个是啥我都忘了,这里说出来也不怕大家笑话,我抄袭了材料系
08级的C++课程内容,因为面对对象的内容完全不会,于是就拼凑了几个人的程序和最终的报告(
丢人,连结题题告都是拼凑的),后来程序还是有不少问题,不过老师审核的时候竟然只发现了一
个问题,哈哈,水过!
两个人的部分和刘铁俊组队。那还真有不少东西可说。(正文本来应该从这里开始,我竟然写了这
么多废话,关键是,有几个人能坚持看到这里???烦不了了,本来就是写给自己看的,下面争取
简略一点吧)
//《酒干倘卖无》
首先是自己收集到很多资料,这意味着我又可以拼凑出一篇完整的课设了,不过后来还是自己写了
,这些资料成了我帮助很多其他同学完成课设的基础。
/*这里打断一下
上文注释里都是现在划过我脑海的歌,这个既有环境氛围,又可以计时哈
估计下面的文字没什么人会看了,我放弃对文章连贯性的要求,胡扯了
*/
//《那些事,那些人》
刘铁俊一直在帮助别人(mm)做课设,所以99%是我搞定的,他那1%是因为最后演示时我刚彻底唾
弃vs,用他的电脑演示的,哈哈!
//《拯救》
后来做了一个背单词的软件,很水,代码大概一百多行吧,就是读进来若干单词,然后随机显示,
没有技术含量,作为参加过ACM培训的娃,读输入还是很在行的,然后最后展示的时候怕没有亮点
,就鬼扯说用的是stl里面的vector存储,后来果然在老师的笔记上看到“亮点stl”的字样,再后来
就是在交源码之前把一个开的很大的数组改成vector。。。。
因为觉得这个一百多行的代码作为大课程设计很不靠谱,于是在演示前的一个下午找学长用mfc做
了一个,果然又是很快就搞定了,然后老师本子上另一个亮点变成“mfc”,哈哈,两个亮点都是
吹出来的。
后来,不少遇到困难的同学找我帮忙,我基本上就是把自己收集好的资料改编一下给他们,比如说
把一个电话簿改成药品管理系统,仔细看里面的”药品数量“用的变量还是phone呢,O(∩_∩)O哈
哈~
最后如愿得了优秀,因为骗老师骗得太深了,之后不少人来找我帮忙,一共大概做了六个人的课设
吧,都是粗制滥造,搞不得好还会被传给学弟学妹,贻害后人。。。(不是我的错哦)
这里应该是文章的前面一小部分,可是写了这么多,下面继续”争取少说废话“。
//《今天你要嫁给我》《我要的飞翔》《》《玄色风》
//忘了记歌名的,发现千千的随机播放列表是同一个序列,返回一下又找到了
这里省略好多,就总结一下“大二上学的《数据库》课程对我非常有用”,会了数据库可以开发好
多有用的东西了,不再垃圾程序了。
寒假学了php,开发了njust poj ranklist,可以看实时排名,每天00:00记录一次,形成排名曲线
,大家蛮喜欢的。不过后来放到了一个不稳定的服务器上,数据库都被黑掉之后了,大受打击,版
本号定格在v0.69,好几个新功能还没上线停止了开发,我想,明年软件课程设计1我会重拾的吧,只
有没找到更好有用题目。
插一句,我现在课设的原则是不做没有用的东西,比如这次java课设酝酿了好久,搬运工写了一半
废掉了,多线程ftp上传下载备好资料并写了一部分之后也废掉了,最终在突如其来的报选题截止时
刻,看到ghostplant报了“java c++ c#评测系统”,Teenager Studio 报了“njust online judge
分布式节点”,于是大脑发热,报了“online judge rating counting system”,这个还没有评估难
度的题目,因为之前一天srm499申小号想混入div1失败,看到gxxlovegxx在div2里面拿到1700+的
恐怖分数,很好奇rating算法。。。
后来就开始辛苦了,下面分点叙述:
1。中文关于rating的资料少之又少,搜了半天都是一样的东西,找资料困惑了我很久,比如
Volatility的初始值是多少?问了白衣神也不知道,后来让在ubuntu里尝试chrome,自动翻译了
tpo的论坛一个讨论,找到了答案
2。tpo rating算法里面有一个看不懂得符号,解释是:xxx is the inverse of the standard
normal function. 这个在线翻译也没能告诉我是神马,于是查老师,查课表,找了一个有米国半年
访问学者经历的老师,告诉我是正态分布,他不是研究概率统计的,不知道怎么算,给了个积分的
公式,这又难倒我了,还好,又是用google发现apache的一个开源项目写好了java的库函数,于
是,果断下载,学习API,调试,期间,为了保证正确率,把还没开始的《概率论与数理统计》翻
了一遍,总算找到验算的数据了,这时,发现之前写的很多代码设计有问题,大大重构了一番
//《寂寞沙洲冷》《雨中飘荡的回忆》
3。如何获得比赛成绩,一开始我没敢再课设题目之前写上njust,准备采用抓取页流的方式获得比赛
成绩,后来很幸运,Teenager Studio的两位大神开放了API,直接通过web服务获取比赛结果,方
便多了!
4。其实我获得API的时候距离截止日期已经不到一个星期了,熬了几夜,中间各种破事,耗费无数
真元,总算搞定了
5。今天演示,很成功,老师比较满意,同学们的评价也不错
6。昨天看面对对象的书,发现我还是根深蒂固的面对过程思维,代码虽然没有bug地实现了所有的
功能,但是代码质量太差,除了我估计谁都看不懂我的代码。今天早上总结了一下,发现了七处需
要重构的地方,等过一阵子闲下来了,就把重构当做训练自己面对对象思路吧!
END
突然通知我周四要讲动态规划报告,我还什么都没准备呢,于是写完这篇文章,暂时放下所有的
java和oo,先搞定报告再说。
写完之后发现cf已经结束了,我的ACM生涯走偏了吗???
roba的咆哮最后指出,项目经验,有木有?有木有?
可是,我想问自己,ACM正规比赛经验,有木有?有木有???
记一次被java虐的经过
poj3844水题,检查同于相同的数量即可,注意一下余数为零的情况,然后ans=西格玛c(2,n)
最近一直在搞java课程设计,一直在用java的ide,于是就悲剧了。。。
不停地TLE,时不时还来几次RE,于是我求助好友,看到他们c++的ac代码,和我差不多一样的,都过了。。。
import java.util.*;
public class Main {
public static void main(String[] args) {
//Scanner cin = new Scanner(System.in);
Scanner cin = new Scanner(new BufferedInputStream(System.in));
int a = cin.nextInt();
for (int cas = 0; cas < a; ++cas) {
int mod = cin.nextInt();
int num = cin.nextInt();
int[] sum = new int[num];
sum[0]=cin.nextInt()%mod;
for (int i = 1; i < num; ++i) {
sum[i]=(sum[i-1]+cin.nextInt())%mod;
}
int[] count =new int[mod];
count[0]=1;
int ans = 0;
for (int i = 0; i < sum.length; i++) {
ans+=count[sum[i]];
count[sum[i]]++;
}
System.out.println(ans);
}
}
}
这代码改成c++肯定过,可惜java超时了。
哎,人品不好
这里转发一篇《给JAVA同学刷OJ的建议》吧,以飨后人:
1. 如果时间或是空间很紧张,不要相信任何系统库。ArrayList, LinkedList, Hashtable, HashMap之类看起来很值得信任很好听的名字效率都低得可怜,不仅如此,还异常地消耗内存。这不是-O2下的vector,即便是std::map的效率都比HashMap高得多。唯一可以信赖的是数组,效率还过得去。
这里说一个小技巧,比如需要实现一个int->int的映射,可以先开一个数组,直接用mod定址,这是非常效率高的。在出现冲突时,再扔到一个HashMap里。一般来说,控制得好的话,HashMap里的总数应该不会达到总共的10%,然后整个时间和空间效率就基本可以满意了,也节约代码。
2. 语言特性和频繁地申请对象使Java不可避免地在效率上远落后于C/C++,但抛开效率,很多在C里会犯的低级错误都不会在Java里犯了,而且运行时抛出的异常有助于迅速检查代码。当测试过几个数据之后,再根据逻辑读一遍代码,就基本是通过了。通读程序很重要,有利于发现测试不易检查出的bug。
3. 如果有一个IDE将大大提高开发的效率,对于C或是C++来说,这种提高很有限,但Java的话则会很多。
4. regex效率尚可,乃一大利器,理论上说,Regional中(只要是Linux系统的Online Judge也可以)C/C++也是可以使用<regex.h>,但功能比java.util.regex里的少得多。
5. Java没有complex,给计算几何代码编写带来一些困难,但实现一个也不是非常困难。Math的功能尚可