bear专题

Codeforces Round #226 (Div. 2) B. Bear and Strings

B. Bear and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The bear has a string s = s1s2... s|s| (record |s|

IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2) E. Bear and Forgotten Tree 2 bfs set 反图的生成树 快速连通块

老规矩,抄一波QSC,自己的写在后面   E. Bear and Forgotten Tree 2 题目连接: http://www.codeforces.com/contest/653/problem/E Description A tree is a connected undirected graph consisting of n vertices and n  -  1 edges.

Codeforces 385B Bear and Strings(字符串)

题目连接:Codeforces 385B Bear and Strings 题目大意:给出一个字符串,问说该字符串中有多少个子串包含“bear”。 解题思路:遍历,每次找到“bear”,就用该串前面个字符数x,以及该串后面的字符数y,ans += (x+1)*(y+1)- 前一个“bear”所在位置的字符串(重复的) #include <stdio.h>#includ

Codeforces 385C Bear and Prime Numbers(数论)

题目链接:Codeforces 385C Bear and Prime Numbers 题目大意:给出一个长度为n的序列,然后有m次询问,每次询问给出a, b,然后计算[a,b]中所有素数的F(x)之和,F(x)为计算序列中有几个数为x的倍数。 解题思路:数论题,因为内存空间限制为512M,所以可以开的下10^7的数组,然后用筛选法求素数的同时计算个数。 #includ

Codeforces 385D Bear and Floodlight(几何+dp)

题目链接:Codeforces 385D Bear and Floodlight 题目大意:给出一个区间[l, r],然后给出n个探照灯,问说n个探照灯能照到区间[l,r]的最大范围。 解题思路:用二进制表示说哪些灯被选中了,dp[i]表示这些灯能够照到的最大范围。 #include <stdio.h>#include <string.h>#include <mat

Codeforces 385E Bear in the Field(矩阵快速幂)

题目链接:Codeforces 385E Bear in the Field 题目大意:有一片n*n的草莓地,每个位置的初始草莓量为横坐标和纵坐标的和,然后每过一秒增长一个草莓。然后给出熊的初始位置(sx,sy),以及移动的速度(dx,dy),每一秒发生的事:(1)速度增加k(k为该位置的草莓数);(2)熊的位置发生移动;(3)每个位置上草莓数+1 解题思路:矩阵快速幂,根据题目给

Bear and Prime 100 CodeForces - 679A(交互题)

This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden number — an integer from interval [2, 100]. Your t

Bear and Blocks CodeForces - 574D

http://codeforces.com/problemset/problem/574/D 最后被拿掉的方块肯定在最底层 对于底层的每一个方块就看它外面包着几层方块 比如1234321 最中间第四个最下面的方块外面有三层 算上自己四层 而左右两边的底层方块就只有三层 关键就是怎么求这个层数 对每个位置i的方块数减去i 看左面最小值 与当前位置作差 就是被破坏的层数 右面同理 这个方法和之前c

Ubuntu 源码安装 lz4c 以及 bear (无root权限情况下)

lz4c 简介 编译 kernel 的时候, 依赖 Image.lz4 二进制 因此需要安装 lz4c 工具, 参考 https://blog.csdn.net/TomAndersen/article/details/106711558 文档 安装。 apt-get -y install liblz4-tool 不过服务器没有 权限, 因此自己手动安装 git clone https

CodeForces 673C Bear and Colors

<span style="font-size:18px;">思路:暴力出奇迹</span> #include<bits\stdc++.h>using namespace std;const int maxn =5005;int a[maxn];int vis[maxn];int ans[maxn];int main(){int n;scanf("%d",&n);for (int i

CodeForces 657A Bear and Forgotten Tree 3

题目链接:http://codeforces.com/problemset/problem/657/A Bear and Forgotten Tree 3 time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: sta

给个让你更爱 Typora的理由:使用 Vue 和 Bear 主题

给个让你更爱 Typora的理由:使用 Vue 和 Bear 主题 Typora 内置了 6 款主题:Github、Gothic、Newsprint、Night、PixyII、Whitey,每个都很漂亮,其中 Github 是我最常用的。 除此之外, Typora 还支持用户自定义主题,不过,自已设计有一定的门槛,不是谁想做就能做的。好在一些高手已经开发出了很多漂亮的主题,可以免费使用,在这

【IndiaHacks 2016 - Online Edition (Div 1 + Div 2) ErrichtoC】【脑洞 好题 讨论?NO!暴力】Bear and Up-Down 多少种一次交

Bear and Up-Down time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The life goes up and down, just like nice sequences. S

【VK Cup 2016 - Round 1 (Div 2 Edition)C】【构造】Bear and Forgotten Tree 3 构造一棵树直径为d且点1的深度为h

Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tree is a connected undirected graph cons

CF#318 (Div. 2)B. Bear and Three Musketeers 暴力 复杂度分析

http://codeforces.com/problemset/problem/574/B 题意:给你n个点,点之间可以连接也可以不连接,求组成的三角形中外部分支的个数,有多个三角形 时求分支最少的个数; #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#

CF #318 (Div. 2) C. Bear and Poker 唯一分解定理

http://codeforces.com/contest/574/problem/C 题意:给你m个数,判断这些数能否通过乘以2或者乘以3最后变成同一个数; #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <vector>#include <

G - Bear and Friendship Condition

题意:朋友的朋友必须也是朋友才行。 解题思路: 若 i号与 j号 是朋友 i号的朋友数必须和j的朋友数必须相同 i的朋友编号和加上自己的编号 等于 j的朋友的编号和加上自己的编号 //是朋友连线数量必须相同#include<stdio.h>#include<string.h>int sta[150005];int z[150005];struct node{int f;int