题目传送门 /* 题意:给定一个数列,求最大的r使得[l,r]的数字能在t次全变为0,每一次可以在m的长度内减1 二分搜索:搜索r,求出sum <= t * m的最大的r 详细解释:http://blog.csdn.net/libin56842/article/details/45082747 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> us…
Tavas and Karafs Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/536/problem/A Description Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kin…
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",…
题目传送门 /* DFS:按照长度来DFS,最后排序 */ #include <cstdio> #include <algorithm> #include <cstring> #include <iostream> #include <cmath> #include <vector> using namespace std; ; const int INF = 0x3f3f3f3f; ] = {, }; int a[MAXN]; in…
题目链接: http://codeforces.com/problemset/problem/535/D D. Tavas and Malekas time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of…
B. Tavas and SaDDas Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/535/problem/B Description Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. Th…
A. Tavas and Nafas Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/535/problem/A Description Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operating syste…
C. Tavas and Pashmaks   Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly …
B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing…
KMP,先预处理按每个节点标记,扫一遍更新每个匹配位置,最后kmp判断是否有重合而且不相同的地方 注意处理细节,很容易runtime error #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #inclu…
题目传送门 /* 题意:一个汉堡制作由字符串得出,自己有一些原材料,还有钱可以去商店购买原材料,问最多能做几个汉堡 二分:二分汉堡个数,判断此时所花费的钱是否在规定以内 */ #include <cstdio> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; char ham[MAXN]; ll n…
A. Tavas and Nafas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operati…
题意:一个等差数列,首项为a,公差为b,无限长.操作cz是区间里选择最多m个不同的非0元素减1,最多操作t次,现给出区间左端ll,在t次操作能使区间全为0的情况下,问右端最大为多少. 这么一个简单题吞了我3小时的时间.主要是没考虑全. 首先,得出ll位置的值a1,如果a1>t那么不可行. 然后分2种情况. 1.区间长度<=m,那么只要右端<=t就行,否则不行. 2.区间长度>m,区间内元素总和<=m*t,且右端<=t就行,否则不行.这个我猜到了,不过忽略了右端<=…
[链接] 我是链接,点我呀:) [题意] 游泳+跑步比赛. 先游泳,然后跑步. 最先到终点的人是winner. 但是现在游泳的距离和跑步的距离长度都不确定. S和R. 给你n个人,告诉你每个人游泳的速度以及它们跑步的速度. 现在问你在改变S,R的情况下,第i个人有没有可能为winner. 输出所有可能为winner的人的编号. [题解] 每个人所花费的时间为\(\frac{S}{si} + \frac{R}{ri}\) 可以看成是向量{S,R}和(\(\frac{1}{si}\),\(\frac…
[链接] 我是链接,点我呀:) [题意] 给你n个位置,然后让你从某些位置开始的|p|个位置,填上p这个字符串. 问你填的时候是否会发生冲突->输出0 否则输出最终n个位置组成的可能的字符串的总数 [题解] 扩展KMP. 画个图会发现. 相邻的两个填写操作. 只要发生了重叠.想要看有没有冲突. 相当于询问从某个位置开始的后缀是否和从0开始的后缀一样. 即看看lcp的长度是否大于等于相交部分即可. 会发现第i-2个字符串如果没有和第i-1个字符串发生冲突. 那么和第i个字符串如果发生了重叠,那么肯…
[链接] 我是链接,点我呀:) [题意] 给你一个规则,让你知道第i根萝卜的高度为si = A+(i-1)*B 现在给你n个询问; 每次询问给你一个固定的起点l; 让你找一个最大的右端点r; 使得l..r这一段能够在t次"m吃操作"内被吃完. [题解] 如果l..r里面的最大值大于t了;则无解 最大值小于等于t的话. 每次可以取m个. 然后可以取t次. 也就是说 这一段里面的和<=m*t; 只要A+(i-1)*B大于1e6了就停下来 最坏情况就是A和B都为1 写个rmq+二分就好…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 每次取出最小的数字,在后面加上一个4或一个7就好; 会发现最后的数字很少的. [代码] #include <bits/stdc++.h> using namespace std; #define ll long long priority_queue <ll,vector <ll>,greater <ll> > dl; vector <ll> v; int main(){ #if…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟题 [代码] #include <bits/stdc++.h> using namespace std; map <int,string> mmap; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", "rt", stdin); #endif mmap[0] = "zero"; mmap[1]…
codeforces 535A-水题: #include <bits/stdc++.h> using namespace std; typedef long long LL; char s2[15][20]={"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen",&q…
Problem A: 实际上对于一段数字假设和为k,每次取较大的m个进行t次减一操作,最多减去的是min(m*t,k). 明白了这个结论就可以直接二分答案了. #include <bits/stdc++.h> #define LL long long using namespace std; LL A, B, n; LL l, t, m, ans; int main() { ios::sync_with_stdio (); cin >> A >> B >>…
Codeforces Round #404 (Div. 2) 题意:对于 n and m (1 ≤ n, m ≤ 10^18)  找到 1) [n<= m] cout<<n; 2) [n>m]最小的 k => (k -m) * (k-m+1) >= (n-m)*2 成立 思路:二分搜索 #include <bits/stdc++.h> #include <map> using namespace std; #define LL long long…
Codeforces Round #725 (Div. 3) 20210704.网址:https://codeforces.com/contest/1538. 感觉这个比上一个要难. A 有一个n个数的数组,我们每次只能拿走最左边/最右边的数.想把最大/最小的数都拿走,最少拿几次. 读入的时候就记录下来最大最小的位置,设左边位置为x,右边位置为y.要不[从左边拿直到拿走y],要不[从右边拿直到拿走x],要不[从左边拿直到x+从右边拿直到y],取个min就可以了. B 大水题,首先判能不能整除(平…
Codeforces Round #719 (Div. 3) 20210703.网址:https://codeforces.com/contest/1520. 没错,我是个做div3的蒟蒻-- A 大水题. B 所有数位都一样的数是[ordinary数](如1,22,333).给一个数n,问小于等于n的[ordinary数]有多少. 直接用一个数组记录[ordinary数],然后以n为key对数组进行二分搜索,返回的下标就是答案.二分搜索:STL的lower/upper_bound. 怎么得到这…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…