上一页 1 2 3 4 5 6 7 8 9 ··· 47 下一页
摘要: 题目传送门 题意:从炮台射出一个球,三个及以上颜色相同的会掉落,问最后会掉落多少个球 分析:先从炮台找一个连通块,然后与顶部连接的连通块都不会掉落,剩下的就是炮台射出后跟随掉落的。 阅读全文
posted @ 2016-03-17 12:33 Running_Time 阅读(292) 评论(0) 推荐(0) 编辑
摘要: DFS A - Joysticks 嫌麻烦直接DFS暴搜吧,有坑点是当前电量<=1就不能再掉电,直接结束。 构造 + 贪心 B - Beautiful Paintings 每次取出不重复的递增序列,直到集合为空 数学 + 容斥 C - Watchmen 化简公式得到找到pair (i, j) xi 阅读全文
posted @ 2016-03-09 14:42 Running_Time 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 水 A - Interview 注意是或不是异或 #include <bits/stdc++.h> int a[1005], b[1005]; int main() { int n; scanf ("%d", &n); for (int i=0; i<n; ++i) { scanf ("%d", a 阅读全文
posted @ 2016-03-06 09:04 Running_Time 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 暴力 A - Orchestra import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner (System. 阅读全文
posted @ 2016-03-03 17:01 Running_Time 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 暴力 A - Ebony and Ivory import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner (n 阅读全文
posted @ 2016-02-29 16:25 Running_Time 阅读(263) 评论(1) 推荐(0) 编辑
摘要: 题目传送门 题意:训练指南P250 分析:DFS记忆化搜索,范围或者说是图是已知的字串构成的自动机图,那么用 | (1 << i)表示包含第i个字串,如果长度为len,且st == (1 << m) - 1则是可能的。打印与之前相似。 #include <bits/stdc++.h> using n 阅读全文
posted @ 2016-02-26 20:27 Running_Time 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 题意:训练指南P248 分析:逆向考虑,比如一个全排列:7345261,它也可以表示成题目中的形式,第一个数字7是由6 * (7 - 1)得到的,第二个数字3有2 * (7 - 2)得到,所以只要树状数组单点修改二分(找最远的因为有些位置是0)查询当前第s[i] + 1的数字(在BIT中 阅读全文
posted @ 2016-02-26 19:43 Running_Time 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 题意:训练指南P248 分析:第一个操作可以用并查集实现,保存某集合的最小高度和最大高度以及城市个数。运用线段树成端更新来统计一个区间高度的个数,此时高度需要离散化。这题两种数据结构一起使用,联系紧密。 #include <bits/stdc++.h> using namespace s 阅读全文
posted @ 2016-02-26 19:14 Running_Time 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 题意:n个数,两种操作,一是每个数字加x,二是查询& (1 << T) == 1 的个数 分析:因为累加是永远的,所以可以离线处理。树状数组点是c[16][M] 表示数字x%(1 << j) 后的数字pos,考虑第j位的个数。当询问时根据add不同的值不同的处理情况。 #include 阅读全文
posted @ 2016-02-26 18:51 Running_Time 阅读(289) 评论(0) 推荐(0) 编辑
摘要: cf的一次数学场。。。 递推 C 题意:长度<=n的数只含有7或8的个数 分析:每一位都有2种可能,累加不同长度的方案数就是总方案数 组合 G 题意:将5个苹果和3个梨放进n个不同的盒子里的方案数。 分析:经典的组合题目:C(n+5-1, 5) * C(n+3-1, 3)。因为可以同一个盒子放多个苹 阅读全文
posted @ 2016-02-24 09:28 Running_Time 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 居然补完了 组合 A - Far Relative’s Birthday Cake import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner c 阅读全文
posted @ 2016-02-23 13:29 Running_Time 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 1001 Rikka with Chess ans = n / 2 + m / 2 1002 Rikka with Graph 题意:n + 1条边,问减去至少一条使剩下的图连通的方案数。 分析:原来暴力选一条或两条就行了,脑子笨了。判连通用BFS或并查集,此题并查集更好 #include <cst 阅读全文
posted @ 2016-02-21 19:35 Running_Time 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 数学 1001 KK's Steel 类似斐波那契求和 #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <m 阅读全文
posted @ 2016-02-17 20:55 Running_Time 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 后面的题目补不懂了 暴力 1001 Clarke and chemistry 这题也把我搞死了。。枚举系数判断就行了 #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <map> i 阅读全文
posted @ 2016-02-17 19:51 Running_Time 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 贪心 A - Guest From the Past 先买塑料和先买玻璃两者取最大值 #include <bits/stdc++.h> typedef long long ll; int main(void) { ll n, a, b, c; std::cin >> n >> a >> b >> c 阅读全文
posted @ 2016-02-16 20:12 Running_Time 阅读(212) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 47 下一页