题目链接:problemId=5383">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5383 Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since ever…
作者:jostree 转载请说明出处 http://www.cnblogs.com/jostree/p/4020792.html 题目链接: zoj 3829 Known Notation 使用贪心+模拟.由于没有数字之间没有空格,因此该题有如下性质: 1.如果该字符串全部为数字,则无需操作,直接输出0. 2.连续的n个数字后面接连续的m个*,当n>m时,一定是有效的答案.从而最终的目的就是把最后的数字尽量向前移动,把最前面非法的*尽量向后移动,因此insert操作添加数字时,只需添加在最前面即…
题目传送门 /* 题意:一串字符串,问要最少操作数使得成为合法的后缀表达式 贪心+模拟:数字个数 >= *个数+1 所以若数字少了先补上在前面,然后把不合法的*和最后的数字交换,记录次数 岛娘的代码实在难懂啊~ */ /************************************************ * Author :Running_Time * Created Time :2015-8-16 14:29:49 * File Name :K.cpp **************…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 给定一个字符串(只包含数字和星号)可以在字符串的任意位置添加一个数字,还可以交换任意两个字符,问需要多少步能得到一个合法后缀表达式. 如果数字<星号+1 那么必须要添加数字,那么肯定是添加在字符串前面是最优的,然后从头到尾扫描整个串,如果遇到星号并且前面出现的数字>=2 数字减1,否则就要从后往前找第一个非*的数字然后与星号交换. 注意全为数字的情况,和处理完后字…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5381 Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy. Entropy is the average amount o…
下午就要坐卧铺赶回北京了.闲来无事.写个总结,给以后的自己看. 因为孔神要保研面试,所以仅仅有我们队里三个人上路. 我们是周五坐的十二点出发的卧铺,一路上不算无聊.恰巧邻床是北航的神犇.于是下午和北航神犇玩了一段时间的杀人游戏,晚上还旁观昂神与众神谈论职场形式,未来出路,认为听着有豁然开朗的感觉(听说网上卖菜比搞IT赚的很多其它,也是醉了).无限YM中...只是尽管是卧铺,想入睡也不是那么easy.睡睡醒醒,也挺折腾 第二天七点多到的牡丹江.感觉尽管都是东北,只是这个小城显然不如我家沈阳繁华,尤…
不知道怎样说起-- 感觉还没那个比赛的感觉呢?如今就结束了. 9号.10号的时候学校还评比国奖.励志奖啥的,由于要来比赛,所以那些事情队友的国奖不能答辩.自己的励志奖班里乱搞要投票,自己又不在,真是无语了--烦得要死.然后在这些事情还没处理好之前我们就这样10号中午从地大去北京站上火车了--那时真感觉这场带着这样的心情来现场赛感觉要打铁了-- 然后10号晚上队友的国奖让琦神帮答辩完了.得国奖无疑了.然后自己的励志奖也定下来一定得了.在火车上的我们也松了一口气.不能由于来比赛国奖励志奖都不得是不-…
主题链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5383 Known Notation Time Limit: 2 Seconds      Memory Limit: 65536 KB Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science.…
Known Notation Time Limit: 2 Seconds      Memory Limit: 131072 KB Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expre…
Description Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expression follows all of its operands. Bob is a student in…