
ACM_实战题
文章平均质量分 76
FlyingPiggy-MissW
我是算法姐姐哈哈哈哈
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
zoj_2812 Quicksum
Requirement: A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used原创 2015-01-29 21:23:47 · 795 阅读 · 0 评论 -
zoj_2840 File Searching
题目链接:zoj 2840 解题思路: 以查询串的"*"为基准,将查询串分为左、右两部分,分别到文件名的两头去对比。 对于左串,直接到文件名的头部去找即可。即如果在文件名的第一个字符处找到左串,则左部匹配; 对于右串,把文件名和右串都倒置,然后按照查找左串的方式判断。查找完毕后别忘了将文件名倒回来,以便别的查找串使用。 做这道题时犯了一个炒鸡低级的错误,跟奇老师花了一个晚上才找出原创 2015-04-03 17:50:10 · 717 阅读 · 0 评论 -
zoj_2476 Total Amount
题目链接:zoj 2476 本以为把蓝书做完了,没想到 还有一条漏网之鱼…… 该题的综合性比较强,涉及到字符串处理、进位处理、反转容器、输出格式处理。 处理字符串要注意一下几点: 1. 输入时删除“$"和 ","以及“.” 用到string::erase(int a, int b)函数,是将字符串从第a个位置(包括a)后的b个字符删除 2. 输出时添加“$"和 ","以原创 2015-04-03 11:38:25 · 523 阅读 · 0 评论 -
zoj_2724 Windows Message Queue
Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process, such as mouse click, text change, the system w原创 2015-03-12 23:44:54 · 672 阅读 · 0 评论 -
zoj_1949 Error Correction
A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property: 1 0原创 2015-03-10 23:38:42 · 547 阅读 · 0 评论 -
zoj_1205 Martian Addition
In the 22nd Century, scientists have discovered intelligent residents live on the Mars. Martians are very fond of mathematics. Every year, they would hold an Arithmetic Contest on Mars (ACM). The ta原创 2015-03-11 00:36:04 · 527 阅读 · 0 评论 -
zoj_1109 Language of FatMouse
We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him. Input Specification Input consists原创 2015-03-11 22:56:39 · 990 阅读 · 0 评论 -
zoj_1151 Word Reverse
For each list of words, output a line with each word reversed without changing the order of the words. Time Limit: 2 Seconds Memory Limit: 65536 KB This problem contains multiple test c原创 2015-03-08 16:37:39 · 564 阅读 · 0 评论 -
zoj_1241 Geometry Made Simple
Mathematics can be so easy when you have a computer. Consider the following example. You probably know that in a right-angled triangle, the length of the three sides a, b, c (where c is the longest原创 2015-03-07 17:38:06 · 418 阅读 · 0 评论 -
zoj_1188 DNA Sorting
One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', this measure is 5,原创 2015-03-08 15:41:36 · 483 阅读 · 0 评论 -
zoj_2001 Adding Reversed Numbers
The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advisor of ACM has decided to transfigure some trage原创 2015-03-08 12:18:10 · 442 阅读 · 0 评论 -
zoj_2723 Semi-Prime 半素数
题目链接:zoj_2723 Semi-Prime 半素数 又是一道有关素数的题,这回找的是半素数,即除了1和本身外,只有两个素数因子。由于数据量大(2 基本思路是建立一个[2,1000 000]范围内的半素数表,读入数据,直接检索。 为了解决这个问题,我们继续使用造福人类的STL——vector & set,分别用来存储素数和半素数。为什么素数的存储原创 2015-03-19 19:58:24 · 2205 阅读 · 0 评论 -
zoj_2876 Phone List
题目链接:zoj_2876 Phone List 本题是要考察一个电话号码是否是另一个号码的前缀。因为数据量大,如果逐一 比较会超时。 对于超时问题,一般考虑两个因素: 1.算法过于低效 2.时间开销在频繁的输入输出上 Tip1:由于这里判断的是前缀,所以只需将所有电话号码从小到大排列,对于每个号码,前面的都不是后面的前缀,那么这组测试案例就符合要求。 Tip2:为了减少时间开销,可采原创 2015-03-19 20:32:45 · 644 阅读 · 0 评论 -
zoj_2744 Palindromes 回文
题目链接:点击打开链接 分析: 本题要求统计一个字符串中包含多少个回文子串,回文就是正读、倒读都是一样的,单个字符串也是回文子串。 为了避免超时错误,这里采用由中心向外扩散的方法判断一个子串是否是回文子串:如果中心的子串不是回文,那么立即终止,不必去判断向外扩散的子串了。 大致思想是: 1.查找子串。首先从左向右读,钉住左边原创 2015-03-19 16:50:16 · 642 阅读 · 0 评论 -
zoj_2420 Calendar
题目链接:zoj 2420 晚上要去参加微软笔试了,把蓝书后面的题目再巩固一下吧。奇老师说的对,练习算法不可以急功近利,模仿别人之后要理解,变成自己的。 解题思路: 用向量建立一个表,把自2000年1月1日到9999年12月31日之间的日期与星期信息放在表中。最后通过查表的方式把日期信息打印出来。虽然建表的时间开销多一点,但是查表十分迅速,不会引起超时。 建表的时候要注意几点:原创 2015-04-03 10:25:20 · 696 阅读 · 0 评论