A. Little Elephant and Chess

  • 模拟。

B. Little Elephant and Magic Square

  • 枚举左上角,计算其余两个位置的值,在\(3\times 3\)判断是否符合题意。

C. Little Elephant and Bits

  • 去掉最前面的0,可以使后面的1往前移。

D. Little Elephant and Elections

  • 对于选中的数,我们只关心其中的lucky number个数,容易想到用数位dp来求,结果用\(c_i\)表示有\(i\)个lucky number的个数。
  • 用\(f(i,j,k)\)表示前\(i\)个人总共有\(j\)个lucky number,以及最后一个人的lucky number个数为\(k\)的方案数。
  • 为了不重复计数,\(k\)要递增枚举,那么最后得到的是严格递增的6个数,结果乘上\(6!\)即可。

E. Little Elephant and LCM

  • 显然,\(b_i\)是最大值的约数。
  • 枚举最大值,求出约数(最多200+个),那么对于每个\(a_i\)我们可以知道其可以取的约数个数。
  • 由于最大值必须要取到,所以在考虑最大值的情况下得到的方案数要扣除不考虑最大值情况的方案数,得到的才是含有最大值的方案数。

Codeforces Round #157 (Div. 2)的更多相关文章

  1. Codeforces Round #157 (Div. 1) B. Little Elephant and Elections 数位dp+搜索

    题目链接: http://codeforces.com/problemset/problem/258/B B. Little Elephant and Elections time limit per ...

  2. Codeforces Round #157 (Div. 2) D. Little Elephant and Elections(数位DP+枚举)

    数位DP部分,不是很难.DP[i][j]前i位j个幸运数的个数.枚举写的有点搓... #include <cstdio> #include <cstring> using na ...

  3. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  4. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  5. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  6. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  7. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  8. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

  9. Codeforces Round #262 (Div. 2) 1004

    Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...

随机推荐

  1. [翻译]MapReduce: Simplified Data Processing on Large Clusters

    MapReduce: Simplified Data Processing on Large Clusters MapReduce:面向大型集群的简化数据处理 摘要 MapReduce既是一种编程模型 ...

  2. 深入浅出设计模式——中介者模式(Mediator Pattern)

    模式动机 在用户与用户直接聊天的设计方案中,用户对象之间存在很强的关联性,将导致系统出现如下问题: 系统结构复杂:对象之间存在大量的相互关联和调用,若有一个对象发生变化,则需要跟踪和该对象关联的其他 ...

  3. 《BI那点儿事》数据流转换——多播、Union All、合并、合并联接

    建立测试数据: CREATE TABLE FactResults ( Name ) , Course ) , Score INT ) INSERT INTO FactResults ( Name , ...

  4. git的一些常用方法

    1.撤销add但未commit的文件: git rm -r --cached path/file 2.git 撤销commit: 2.1).git log-显示提交的历史 commit ee50348 ...

  5. jdom xml解析

    import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; import org.xml. ...

  6. CSS 超出隐藏问题

    .dropdown-navbar>li:last-child>a { border-bottom: 0 solid #DDD; border-top: 1px dotted transpa ...

  7. lhgdialog: iframe页面里面的,确定,关闭、取消按钮的操作

    lhgdialog: iframe页面里面的,确定,关闭.取消按钮的操作 如果你正在用lhgdialog,用他人iframe,或者 content:'url:http://www.baidu.com/ ...

  8. Yii MySQL修改数据库的数据

    最新学习Yii框架,分享一些学习心得,适合初学者,大神请按ctrl + w //第一种方法 <?php /* * $id 代表主键,可以是一个也可以是一个集合. * $attributes 代表 ...

  9. C#获取参数getParameter

    昨天遇到了这样一个问题,getParameter时,首次进入页面读取默认值时,本应该读取到“全部”这个字符. 然后在实际读取过程当中却不是这样,实际读取到的是  类的对象值 重新运行时能够读取到 “全 ...

  10. java写hadoop全局排序

    前言: 一直不会用java,都是streaming的方式用C或者python写mapper或者reducer的可执行程序.但是有些情况,如全排序等等用streaming的方式往往不好处理,于是乎用原生 ...