摘要:
给定一段文字,已知单词a1, a2, …, an出现的频率分别t1, t2, …, tn。可以用01串给这些单词编码,即将每个单词与一个01串对应,使得任何一个单词的编码(对应的01串)不是另一个单词编码的前缀,这种编码称为前缀码。 使用前缀码编码一段文字是指将这段文字中的每个单词依次对应到其编码。
阅读全文
posted @ 2017-05-22 13:56
Dilthey
阅读(1023)
推荐(0)
摘要:
2017江苏省赛的E题,当时在场上看错了题目没做出来,现在补一下…… 题目链接:http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1264(注意在上面使用G++编译的话,请使用%I64d) Time Limit : 3000 M
阅读全文
posted @ 2017-05-19 09:28
Dilthey
阅读(341)
推荐(0)
摘要:
题目链接:http://acm.ecnu.edu.cn/problem/3260/ Time limit per test: 1.5 seconds Time limit all tests: 10.0 seconds Memory limit: 256 megabytes Time limit a
阅读全文
posted @ 2017-05-17 08:51
Dilthey
阅读(248)
推荐(0)
摘要:
Time limit per test: 2.0 seconds Time limit all tests: 15.0 seconds Memory limit: 256 megabytes Time limit per test: 2.0 seconds Time limit all tests:
阅读全文
posted @ 2017-05-12 23:12
Dilthey
阅读(366)
推荐(0)
摘要:
一定要纪念一下第一道在比赛中自己做出来的贪心。 题目链接:http://acm.ecnu.edu.cn/problem/3263/ Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256
阅读全文
posted @ 2017-05-12 23:06
Dilthey
阅读(387)
推荐(0)
摘要:
从Y1-M1-D1到Y2-M2-D2间所有日期,出现多少个9? 呃讲真,刚开始想这个题目还是很烦的,各种要考虑的情况…… 最后思考这样: 对于任何输入,设输入分别为 st.y st.m st.d ed.y ed.m ed.d ,分成三种情况: ①st.y==ed.y,两个日期出现在同一年里,直接暴力
阅读全文
posted @ 2017-05-10 20:09
Dilthey
阅读(167)
推荐(0)
摘要:
让我回想起了小学的时候,空瓶换饮料还能向别人借一个空瓶喝了再还回去的神奇问题…… 开始时思考,特判一下a=1或者b=1的情况为INF就可以了,然后发现2 2 1 2这样的样例也是能够喝到无穷多瓶饮料的。 所以干脆直接做循环,每次循环模拟换了饮料然后喝掉的情形,如果发现喝完空瓶子不减少或者瓶盖子不减少
阅读全文
posted @ 2017-05-10 19:45
Dilthey
阅读(340)
推荐(0)
摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Descripti
阅读全文
posted @ 2017-05-08 21:32
Dilthey
阅读(342)
推荐(0)
摘要:
题目链接:http://acm.uestc.edu.cn/#/problem/show/1059 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) 秋实大哥以周济天下,锄强扶弱为己任,他常对
阅读全文
posted @ 2017-05-08 19:44
Dilthey
阅读(243)
推荐(0)
摘要:
题目链接:http://acm.uestc.edu.cn/#/problem/show/1057 线段树的第一题,看着题解和讲解,自己把模板一点点慢慢码出来的。 线段树讲解:http://www.cnblogs.com/TenosDoIt/p/3453089.html 2018-5-1更新 今天又看
阅读全文
posted @ 2017-05-08 14:20
Dilthey
阅读(311)
推荐(0)
摘要:
首先,可以自己先一个超时的标程出来: 那么考虑如何进行时间优化: 这样一来,原本例如(2 + 3)mod 5 = 0 的情况,我们得到的是 ( i_num = 1 ) * ( j_num = 1 ) = 1,1对( i , j ), 现在就可以使 ( i_num = 2 ) * ( j_num =
阅读全文
posted @ 2017-05-07 09:38
Dilthey
阅读(386)
推荐(0)
摘要:
Time Limit: 10000ms Memory Limit: 262154KB 64-bit integer IO format: %lld Java class name: Main Time Limit: 10000ms Memory Limit: 262154KB 木衫同学和凌小小都是军
阅读全文
posted @ 2017-05-07 08:11
Dilthey
阅读(353)
推荐(0)
摘要:
花了半个小时,强行拗出一长串又臭又长的代码,把所有情况都分了(该分的,不该分的……都分了……)
阅读全文
posted @ 2017-05-06 22:38
Dilthey
阅读(316)
推荐(0)
摘要:
Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description There are n Doge Planets in the Doge Space. The
阅读全文
posted @ 2017-05-06 09:51
Dilthey
阅读(205)
推荐(0)
摘要:
Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Input There are several test cases. Please process till EOF.For ea
阅读全文
posted @ 2017-05-05 23:30
Dilthey
阅读(283)
推荐(0)
摘要:
原本是数据结构课的作业……到后来没查,放着占内存,删了有点浪费,干脆扔在博客上吧……
阅读全文
posted @ 2017-05-05 09:58
Dilthey
阅读(179)
推荐(0)
摘要:
RMQ应用题。 引用别人的解题思路:
阅读全文
posted @ 2017-05-04 23:21
Dilthey
阅读(247)
推荐(0)
摘要:
题目链接:http://poj.org/problem?id=3368 RMQ应用题。 解题思路参考:http://blog.csdn.net/libin56842/article/details/46482803 附一个网上的数据生成器:
阅读全文
posted @ 2017-05-03 13:13
Dilthey
阅读(165)
推荐(0)
摘要:
Description Mike moved to a new city. There are bus stations in the city, each has a unique name. Each bus has its designated schedule, and sequential
阅读全文
posted @ 2017-04-28 22:49
Dilthey
阅读(255)
推荐(0)
摘要:
题目链接:http://poj.org/problem?id=3928 树状数组的应用。 把每个人当做裁判进行遍历,计算住在这个人之前的人中有多少个是比他弱的,记为pre_less[i],多少个人比他强的记为pre_more[i];同样的,住在他后面的人中,比他弱的记为suf_less[i],比他强
阅读全文
posted @ 2017-04-27 19:33
Dilthey
阅读(220)
推荐(0)
摘要:
Time Limit: 1000MS Memory Limit: 65536K Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. J
阅读全文
posted @ 2017-04-25 20:34
Dilthey
阅读(320)
推荐(0)
摘要:
思路来自http://blog.csdn.net/Courage_kn/article/details/69218592 用#define比定义一个lowbit函数快……不过好像很多时候不能像函数那样随便用,容易出问题…… 这是分别用 long long lowbit(long long x){re
阅读全文
posted @ 2017-04-24 21:27
Dilthey
阅读(262)
推荐(0)