题意:一个等差数列,首项为a,公差为b,无限长.操作cz是区间里选择最多m个不同的非0元素减1,最多操作t次,现给出区间左端ll,在t次操作能使区间全为0的情况下,问右端最大为多少. 这么一个简单题吞了我3小时的时间.主要是没考虑全. 首先,得出ll位置的值a1,如果a1>t那么不可行. 然后分2种情况. 1.区间长度<=m,那么只要右端<=t就行,否则不行. 2.区间长度>m,区间内元素总和<=m*t,且右端<=t就行,否则不行.这个我猜到了,不过忽略了右端<=…
题目传送门 /* 题意:给定一个数列,求最大的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…
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #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…
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…
535C - Tavas and Karafs 思路:对于满足条件的r,max(hl ,hl+1 ,hl+2 ,......,hr )<=t(也就是hr<=t)且∑hi<=t*m.所以通过这个条件二分找出最大的r. 二分的下界为1,上界为使得hi等于t的i(hi=t    ==>    a+(i-1)*b=t    ==>    i=(t-a)/b+1) 代码: #include<bits/stdc++.h> using namespace std; #defin…
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…
[链接] 我是链接,点我呀:) [题意] 给你一个规则,让你知道第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+二分就好…
题目链接: 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…