Codeforces Round #157 (Div. 2)
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)的更多相关文章
- 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 ...
- Codeforces Round #157 (Div. 2) D. Little Elephant and Elections(数位DP+枚举)
数位DP部分,不是很难.DP[i][j]前i位j个幸运数的个数.枚举写的有点搓... #include <cstdio> #include <cstring> using na ...
- 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 ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- 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 ...
- 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 ...
随机推荐
- 深入浅出设计模式——适配器模式(Adapter Pattern)
模式动机 在软件开发中采用类似于电源适配器的设计和编码技巧被称为适配器模式. 通常情况下,客户端可以通过目标类的接口访问它所提供的服务.有时,现有的类可以满足客户类的功能需要,但是它所提供的接口不一定 ...
- php的rss订阅
一般来说我们很少自己造轮子,读取rss还是用git上的开源库吧 https://github.com/dg/rss-php 这个开源库不能读取博客园的rss订阅,新浪微博的格式显示有问题. 博客园的订 ...
- yii2中gii外网访问的配置方法
if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debu ...
- C\C++ 获取当前路径
C\C++ 获取当前路径 获取当前工作目录是使用函数:getcwd.cwd指的是“current working directory”,这样就好记忆了. 函数说明: 函数原型:char* getc ...
- 临时文件相关的v$tempfile v$sort_usage与V$tempseg_usage
SQL> select username,user,segtype,segfile#,segblk#,extents,segrfno# from v$sort_usage; SEGFILE#代表 ...
- nginx反向代理实现跨域请求
nginx反向代理实现跨域请求 跨域请求可以通过JSONP实现,缺点是需要修改被请求的服务器端代码进行配合,稍显麻烦通过在自己服务器上配置nginx的反向代理,可以轻松实现跨域请求 思路 示例服务器A ...
- std::vector介绍
vector是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库.vector之所以被认为是一个容器,是因为它能够像容器一样存放各种类型的对象,简单地说,vec ...
- HTML 折行 <br/>标签
定义和用法: <br/>可插入一个简单的换行符. br标签是单独出现的,<br /> 当使用br标签时,其后面的所有内容都将在下一行出现 属性 Common -- 一般属性 c ...
- Leetcode 58 Length of Last Word 难度:0
https://leetcode.com/problems/length-of-last-word/ int lengthOfLastWord(char* s) { int ans = 0; int ...
- QT快速使用ntohs
QT快速使用ntohs,需要注意3点:1. ntohs只是转换相邻的2个字节2. 引入头文件#include <windows.h>3. 需要加上win32{LIBS+=-lws2_32} ...