Educational Codeforces Round 9

Longest Subsequence

题目描述:给出一个序列,从中抽出若干个数,使它们的公倍数小于等于\(m\),问最多能抽出多少个数,并输出方案与公倍数。

solution
枚举每一个数,将它的倍数的答案加一,最大值就是答案。

时间复杂度:\(O(nlogn)\)

Thief in a Shop

题目描述:给出\(n\)中物品与它们的价值,每种物品都有无限个,问从中拿出\(m\)个,价值有可能是什么,输出所有的价值。

solution
快速幂+FFT
要注意的是这里只是判断是否有这一价值,所以每一次要把大于零的位置改为一,否则会爆long long
每一次FFT时取当前的最大长度,这样可以减少一个\(logn\)的复杂度。
我终于都看到FFT的龟速。

时间复杂度:\(O(10^3mlogm)\)

Educational Codeforces Round 9的更多相关文章

  1. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  2. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  3. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  4. [Educational Codeforces Round 16]B. Optimal Point on a Line

    [Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...

  5. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  6. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

  7. Educational Codeforces Round 37

    Educational Codeforces Round 37 这场有点炸,题目比较水,但只做了3题QAQ.还是实力不够啊! 写下题解算了--(写的比较粗糙,细节或者bug可以私聊2333) A. W ...

  8. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  9. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

随机推荐

  1. cxf2.7.10 与 spring3.0.5集成

    开发环境: NetBeans7.4 Tomcat 6.0.32 一 服务端: 1:新建JavaWeb工程 cxfspring-server,导入jar包如下图所示: 2:在web.xml文件中添加如下 ...

  2. zabbix 通过gateway 获取远程主机的JMX信息

    DBHost=192.168.32.55 DBName= zabbix DBUser=zabbixuser DBPassword=zabbixpass StartTrappers=20 MaxHous ...

  3. qsort排序算法

      七种qsort排序方法 <本文中排序都是采用的从小到大排序> 一.对int类型数组排序 int num[100]; Sample: int cmp ( const void *a ,  ...

  4. Add Digits 解答

    Question Given a non-negative integer num, repeatedly add all its digits until the result has only o ...

  5. linux内存操作----kernel 3.5.X copy_from_user()和copy_to_user()

    前面的一篇文章中简单的描写叙述了一下内存映射的内容,http://blog.csdn.net/codectq/article/details/25658813,这篇文章作为用户把内存规划好之后,在用户 ...

  6. Android Studio虚拟机配置虚拟键盘

    1. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2pjMjExMzIy/font/5a6L5L2T/fontsize/400/fill/I0JBQkF ...

  7. 【HeadFirst 设计模式总结】2 观察者模式

    作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 1.我们需要理解报社.订阅系统和订报人之间的关系,订报人通过订阅系统订报,一旦报社有新的报纸,订阅系统就会派人送 ...

  8. SQL Server 2008 修改表名

     有一张表  修改起 if exists (select * from sys.objects where object_id = object_id(N'Table_1') and type in ...

  9. canvas、image src、data url、blob file conversion

    //canvas.toDataURL('image/jpeg'), and convert to blob,blob is a File Object. but UC don't support fu ...

  10. DevExpress中SearchLookUpEdit用法总结

    在前一个项目中用到了DevExpress,需要搜索某一个字段,来拉取出对应的相关信息,比来比去,发现SearchLookUpEdit的用户体验更好,但自己是个不折不扣的C#和DevExpress的初学 ...