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. php : 匿名函数(闭包) [二]

    摘自: http://www.cnblogs.com/yjf512/archive/2012/10/29/2744702.html php的闭包(Closure)也就是匿名函数.是PHP5.3引入的. ...

  2. jquery总结05-常用事件02-表单事件

    表单事件 .focus()元素获得焦点时 阻止冒泡 子元素不可以 .blur() 元素失去焦点时 阻止冒泡 子元素不可以 .change() input.select.textarea值发生改变时 i ...

  3. php总结 --- 2.字符串

    字符串 恩聪 正则表达式 恩聪 中文验证 if (preg_match("/[\x{4e00}-\x{9fa5}]{2,4}\s{0,}\w{8,15}/u", $keyword) ...

  4. 获得省市 json 后台代码

    string connString = ConfigurationManager.ConnectionStrings["connStr"].ToString(); SqlConne ...

  5. zabbix3.0.4 部署之五 (LNMP > nginx1.9.9)

    1 wget http://nginx.org/download/nginx-1.9.9.tar.gz cd /opt/pcre-8.35 autoreconf -ivf Installing sha ...

  6. 浅谈HTTP协议(下)

    下面来讲响应消息.响应消息也分为响应起始行.响应头部.CRLF.响应主体. 响应起始行包括协议版本.响应状态码.原因短句.这里的重点就是响应状态码,它一共分为5类,状态码准确的说是一个三位数. 1xx ...

  7. 安卓手机上运行 PC-E500 程序

    目录 第1章安卓手机上运行 PC-E500 程序    1 1 PockEmul    1 2 下载    1 3 打包BASIC程序    2 4 配置PC-E500模拟器    5 5 载入e50 ...

  8. android 5.0 水波纹 实现

    1. 定义一个普通圆角背景的xml; rounded_corners.xml <?xml version="1.0" encoding="utf-8"?& ...

  9. PHP二次开发discuz3.2最新体验

    康盛官方于6月4号发布了discuz3.2的正式版,因为这两天一直忙于一个项目,一直没来的及体验,现在抽时间总算是装上了,也体验一把. 根据官方说明:Discuz! X3.2 在继承和完善 Discu ...

  10. C++指针之防不胜防

    我们在使用指针时,经常会出现下面几种错误: 1) 内存分配未成功,却使用了它. 编程新手常犯这种错误,因为他们没有意识到内存分配会不成功.常用解决办法是,在使用内存之前检查指针是否为NULL.如果指针 ...