Codeforces Round #116 (Div. 2, ACM-ICPC Rules)
Codeforces Round #116 (Div. 2, ACM-ICPC Rules)
代码
A. Defragmentation
- 按颜色分配\(1\)到\(\sum_{i=1}^{m}{n_i}\)位置,那么可以得到\(t_i\)表示位置\(i\)最后占据位置\(t_i\),-1表示该位置为空。
- 那么会出现两种情况:
- \(t_1 \to t_2 \to \cdots \to \ {-1}\),即一条链,从后面往前覆盖。
- \(t_1 \to t_2 \to \cdots \to t_i \to t_1\),构成一条链,那么找到一个空位置,将其中一个值暂存在空位置上,变成一条链,最后再把暂存的值放到相应的位置上。
B. Divisibility Rules
- \(2-type\):\[gcd(d, b, b^2, \cdots, b^k) = 1\]
- \(3-type\):\[(b-1)\ mod\ d =0\]
- \(11-type\):\[(b+1)\ mod\ d =0\]
- \(6-type\):分解质因数,判断每种是否都能表示成前3种之一。
C. Letter
- 枚举边界,统计前半部分大写字母个数,后半部分小写字母个数。
D. Name
- 尽可能让前缀相等。
- \(t\)是\(s\)的前缀情况特判。
E. Cubes
- 统计每种颜色的位置。
- 每种颜色单独做,维护左右边界,当操作次数超过k时缩小范围。
F. Mathematical Analysis Rocks!
- \[p[a[i]] = b[i]\]
Codeforces Round #116 (Div. 2, ACM-ICPC Rules)的更多相关文章
- codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)
题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和
E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table【递推】
A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 贪心 Codeforces Round #289 (Div. 2, ACM ICPC Rules) B. Painting Pebbles
题目传送门 /* 题意:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles, 使得任意两个piles,用颜色c填充的pebbles数量 ...
- 递推水题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table
题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include ...
- Codeforces Round #622 (Div. 2) B. Different Rules(数学)
Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) E. Cubes (尺取)
题目链接:http://codeforces.com/problemset/problem/180/E 给你n个数,每个数代表一种颜色,给你1到m的m种颜色.最多可以删k个数,问你最长连续相同颜色的序 ...
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) C. Letter 暴力
C. Letter Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/180/problem/C D ...
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) Letter(DP 枚举)
Letter time limit per test 1 second memory limit per test 256 megabytes input standard input output ...
随机推荐
- 哪些字符需要urlencode编码?具体怎么处理?
哪些字符需要urlencode编码?具体怎么处理? JS用escape()/encodeURI()/encodeURIComponent()方法编码,用unescape()/decodeURI()/e ...
- iOS9/iOS8界面对比 XCode7
Xcde7 bate 无需开发这账号(99¥)可以调试程序 目前是测试版 iOS9/iOS8界面对比 (注:左边为iOS8界面,右边为iOS9界面.) 1.新字体 苹果在 iOS9 中使用旧金山字体取 ...
- C++C++ 指针(二)--c++ 指针(二)--c++
一.内存管理:new和delete 1.new操作符:从操作系统获得内存块,并返回该内存块的首地址. delete操作符:将new申请的内存返还给操作系统. 开始一个简单的例子: #include & ...
- switch… case 语句的用法(二)
总结来说:switch的用法是判断case后面的表达式和switch后面的表达式是否相匹配,一旦case匹配,就会顺序执行后面的程序代码,而不管后面的case是否匹配,直到遇见break.都不匹配找d ...
- 无刷新 checkbox列表的删除
前台 JS : function ModelDelete() { var checkvalues = null; var checValue = $("#dom1").find(& ...
- 在hibernate中用sql语句
在hibernate中用sql语句,语句是createSQLquery 查出来的是,一列或者多列的数据,要将其转化为对象,有两种方式, 对于已经被hibernate所管理的实体类,在后面加.adden ...
- 表单验证与Json配合
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...
- 2016 - 1 - 22 HTTP(二)
一: 发送HTTP请求的方法 1.在HTTP/1.1中规定了8种发送请求的方法: 2.发送请求时需要参数,比如POST中的账号密码 二:POST与GET的对比 1.GET与POST的主要区别表现在数据 ...
- How many instances created in the WebContainer
When the Servlet container starts, it: reads web.xml; finds the declared Servlets in the classpath; ...
- hdu5853 (后缀自动机)
Problem Jong Hyok and String 题目大意 给你n个字符串,有q个询问. 定义set(s)={(i,j)} 表示 s在第i个字符串中出现,且末尾位置为j. 对于一个询问,求se ...