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 ...
随机推荐
- JAVA的UDP协议交互信息
由于要做app的UDP协议交互,所以就特地学习了下,其实也就类似于java的server和socket,下面就写了个简单的demo 服务端: package com.test1; import jav ...
- linux 下安装安装rz/sz命令
一.软件安装 root 账号登陆后,依次执行以下命令: cd /tmp wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz http:/ ...
- Deep Learning 3_深度学习UFLDL教程:预处理之主成分分析与白化_总结(斯坦福大学深度学习教程)
1PCA ①PCA的作用:一是降维:二是可用于数据可视化: 注意:降维的原因是因为原始数据太大,希望提高训练速度但又不希望产生很大的误差. ② PCA的使用场合:一是希望提高训练速度:二是内存太小:三 ...
- 20145224&20145238 《信息安全系统设计基础》第二次实验
20145224&20145238 <信息安全系统设计基础>第二次实验 课程:信息安全系统设计基础 班级:1452 姓名:陈颢文 荆玉茗 学号:20145224 20145238 ...
- JavaWeb基础: ServletContext
基本概念 Web容器在启动时,会为每个Web应用程序都创建一个对应的ServletContext对象,它代表当前Web应用. ServletContext(javax.servlet.http.Ser ...
- linux下多路复用模型之Select模型
Linux关于并发网络分为Apache模型(Process per Connection (进程连接) ) 和TPC , 还有select模型,以及poll模型(一般是Epoll模型) Select模 ...
- Linux服务器数据库的导入和导出
一.导出: 用mysqldump命令行 命令格式 mysqldump -u 用户名 -p 数据库名 > 数据库名.sql 范例: mysqldump -u root -p abc > ab ...
- HDU 3016 线段树区间更新+spfa
Man Down Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- css布局之两列布局
我们见过两列布局的网站也很多,不过这种两列布局的分为两种:自适应和固定宽度 1.自适应两列布局 <!DOCTYPE html> <html lang="en"&g ...
- 修改 UISearchBar cancelButton 样式
今天收到个问题,老大让我修改UISearchBar cancelButton的样式本来以为很简单的一个活,没想到让我长知识了. 开始在网上搜到的方法和我想象的一样,通过遍历Subviews获得butt ...