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 ...
随机推荐
- iOS图片攻略之:有3x自动生成2x 1x图片
关键字:Xcode插件,生成图片资源 代码类库:其他(Others) GitHub链接:https://github.com/rickytan/RTImageAssets 本项目是一个 Xc ...
- python抓取性感尤物美女图
由于是只用标准库,装了python3运行本代码就能下载到多多的美女图... 写出代码前面部分的时候,我意识到自己的函数设计错了,强忍继续把代码写完. 测试发现速度一般,200K左右的下载速度,也没有很 ...
- jQuery 常用动画
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- iOS 中 #import同@class之间的区别
很多刚开始学习iOS开发的同学可能在看别人的代码的时候会发现有部分#import操作写在m文件中,而h文件仅仅使用@class进行声明,不禁纳闷起来,为什么不直接把#import放到h文件中呢? 这是 ...
- Oge中Mesh的渲染流程详述
转自:http://blog.csdn.net/yanonsoftware/article/details/1041396 首先一个Entity对象必须Attach到一个SceneNode. 1.创建 ...
- (转)深入理解javascript的function
原文:http://www.cnblogs.com/sharpxiajun/archive/2011/09/16/2179323.html javascript笔记:深入理解javascript的fu ...
- 通过一个Thinkphp完成多个项目
1.单独取压缩包中的Thinkphp文件夹 2.在单独的项目内创建一个引入文件 3.通过浏览器访问该index.php 会创建相应的目录
- Svn win7系统下状态图标不显示-转载
Svn win7系统下状态图标不显示 Svn版本 tortoisesvn-1.8.8.25755-x64-svn-1.8.10.msi 2.不显示图标状态如图1,期望结果显示图标状态如图2 图1 图2 ...
- codeforces 707D-(DFS+bitset)
题目链接:http://codeforces.com/contest/707/problem/D 根据询问建立一棵树然后DFS. #include<bits/stdc++.h> using ...
- VM设置BIOS延长时间
更改文件中的 bios.bootDelay = "XXXX"