C - Maximum Subrectangle 因为是两个数组相乘的到的 矩阵所以  a(i ->j)*b(x->y) 的面积 就是   a(i ->j) 的和乘与b(x->y)的和 所以我们枚举 a 序列 从1-n的长度和  B序列同理 然后 枚举两个序列和相乘 找一个最大即可 #include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define LL long long #defin…
A: 题目大意:给你一个数字串,每个数字只可以用一次,求最多可以组成多少个电话号码(可以相同),电话号码第一个数字为$8$,且长度为$11$ 题解:限制为$8$的个数和总长度,直接求 卡点:无 C++ Code: #include <cstdio> #include <algorithm> #define maxn 1000 inline int min(int a, int b) {return a < b ? a : b;} inline int max(int a, i…
https://codeforces.com/contest/1060/problem/C 题意 给两个数组,a数组有n个元素,b数组有m个元素,两个数组元素互相相乘形成n*m的矩阵,找一个子矩阵,元素和<=x,子矩阵的面积尽量大,求这个子矩阵的面积大小 思路 一开始往二维前缀和+暴力+查询之类想了,没观察规律,复杂度怎么想都不对 规律其实就是 子矩阵的和等于两个数组的连续子序列和相乘,面积大小等于子序列长度相乘 即要在两个数组中找出两个连续的子序列,保证他们的和相乘<=x的情况下,长度的乘积…
A. Phone Numbers 签. #include <bits/stdc++.h> using namespace std; #define N 110 char s[N]; ], n; int main() { while (scanf("%d", &n) != EOF) { scanf(); memset(cnt, , sizeof cnt); ; i <= n; ++i) ++cnt[s[i] - ']; ; ; i <= cnt[]; ++…
Codeforces Round #513 游记 A - Phone Numbers 题目大意: 电话号码是8开头的\(1\)位数字.告诉你\(n(n\le100)\)个数字,每个数字至多使用一次.问最多能凑出多少个电话号码. 思路: 统计8出现的次数,如果有多余的8不能作为开头,那么就将其放到后面去 源代码: #include<cstdio> #include<cctype> #include<algorithm> inline int getint() { regi…
A. Is it rated? time limit per test  2 seconds memory limit per test  256 megabytes Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it. Another Codeforces round has bee…
前记 眼看他起高楼:眼看他宴宾客:眼看他楼坍了. 比赛历程 开考前一分钟还在慌里慌张地订正上午考试题目. “诶这个数位dp哪里见了鬼了???”瞥了眼时间,无奈而迅速地关去所有其他窗口,临时打了一个缺省源. A. Phone Numbers 那么就是模拟. #include<bits/stdc++.h> int n,x; ]; int read() { char ch = getchar(); ; ; for (; !isdigit(ch); ch=getchar()) ; for (; isd…
比赛传送门 10月4号的比赛,因为各种原因(主要是懒),今天才写总结-- Div1+Div2,只做出两个题+迟到\(20min\),日常掉\(rating\)-- \(\rm{A.Phone\;Numbers}\) 很水的一道题目,直接输出cout<<min(n/11,tot);(\(tot\)为数字\(8\)的数量) \(\mathcal{Maximum\;Sum\;of\;Digits}\) 一点小贪心,我们让\(9\)最多就行了,证明吗--感性的理解一下吧 \(\mathfrak{Max…
首次正式的$Codeforces$比赛啊,虽然滚粗了,然而终于有$rating$了…… #A  Phone Numbers 签到题,然而我第一次写挂了(因为把11看成8了……) 只需要判断一下有多少个8,再特判一下能存在多少个号码就好了 #B  Maximum Sum of Digits 我的做法是暴力打表找规律,发现全都是向下取除首位外其他都是9的数作为一个加速,然后就没了 然而没发现0也是可行的……又WA了一次 #C  Maximum Subrectangle 苦像$20min$没有思路,只…
我是比赛地址 A:Phone Numbers $Description$:给你一串数字,问你能组成多少开头为8的11位电话号码. $Sol$:统计8的数量,与$n$%11作比较. #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int n,len,cnt,ans; ]; int main() { scanf("%d",&n); scanf(…
A. Phone Numbers 题意:给一些数字,每个电话号码以8开头,11位,求最多组成多少个号码,重复累加. #include <bits/stdc++.h> using namespace std; ; char str[maxn]; int main() { int n; scanf("%d%s",&n,str); ; ; i < strlen(str); i++) { ') cnt++; } while(cnt) { ) break; cnt--;…
A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to a…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec Problem Description Input Output The only line should contain the minimal number of days required for the ship to reach the point (x2,y2)(x2,y2). If it…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec Problem Description Input The input contains a single line consisting of 2 integers N and M (1≤N≤10^18, 2≤M≤100). Output Print one integer, the total n…
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(x)…
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w…
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进行一次翻转,问是否存在一种方案,可以使得翻转后字符串的字典序可以变小.   这个很简单,贪心下就行了. 代码如下: Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5…
A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to a…
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 <= n <= 200000\), 如果至多删除其中的一个数之后该序列为严格上升序列,那么称原序列为几乎严格上升序列. 现在每次将序列中的任意数字变成任意数字,问最少要操作几次才能将序列变成几乎严格上升子序列. 思路: 如果不考虑删除,求让整个序列都变成严格上升子序列的次数 求出\(序列a_i - i\)…
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforces.com/contest/1016/problem/C 题意: emmm,说不清楚,还是直接看题目吧. 题解: 这个题人行走的方式是有一定的规律的,最后都是直接走到底,然后从另外一行走回来.并且通过画图观察,会发现他走到格子的时间会有一定的规律. 所以就维护几个前缀和就行了,从1到n枚举一下,还要…
Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best Subsegment 题意: 给出n个数,选取一段区间[l,r],满足(al+...+ar)/(r-l+1)最大,这里l<=r,并且满足区间长度尽可能大. 题解: 因为l可以等于r,所以我们可以直接考虑最大值,因为题目要求,直接求连续的最大值的长度就是了. 代码如下: #include <bits…
Codeforces Round #423 (Div. 1, rated, based on VK Cup Finals) A.String Reconstruction B. High Load C. DNA Evolution 题意:给定一个只包含A,T,C,G的字符串S,有如下两种操作 1)修改一个点的字母. 2)给定一个字符串e ($\left | e \right |\leq 10$),生成一个由e重复组成的新串,eee...,问$S_{l..r}$中有几个字母跟这个新的字符串一一对应…
Educational Codeforces Round 59 (Rated for Div. 2) D. Compression 题目链接:https://codeforces.com/contest/1107/problem/D 题意: 给出一个n*(n/4)的矩阵,这个矩阵原本是一些01矩阵,但是现在四个四个储存进二进制里面,现在给出的矩阵为0~9以及A~F,表示0~15. 然后问这个矩阵能否压缩为一个(n/x)*(n/x)的矩阵,满足原矩阵中大小为x*x的子矩阵所有数都相等(所有子矩阵构…
Educational Codeforces Round 58 (Rated for Div. 2)  题目总链接:https://codeforces.com/contest/1101 A. Minimum Integer 题意: 多组数据,给你三个数l,r,d,要求在区间[l,r]之外找一个最小的x,使得x%d==0. 题解: 当d<l or d>r的时候,直接输出d就好了. 当l<=d<=r的时候,找到最小的t,使得t*d>r就行了. 具体操作见代码: #include…
Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) A. Single Wildcard Pattern Matching 题意就是匹配字符的题目,打比赛的时候没有看到只有一个" * ",然后就写挫了,被hack了,被hack的点就是判一下只有一个" * ". 代码: //A #include<iostream> #include<cstdio>…
Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 全场题解 菜鸡只会A+B+C,呈上题解: A. Bear and Big Brother 题意:我也没看太清,就是给你两个10以内的数a,b.a每天乘以3,b每天乘以2,求多少天后a大于b. 思路:应该是有公式的,不过看到数据这么小直接暴力乘求解.官方题解貌似就是这样,数据小就是水题. const int N=1e3+10; int main() { int a…
Educational Codeforces Round 34 (Rated for Div. 2) A Hungry Student Problem 题目链接: http://codeforces.com/contest/903/problem/A 思路: 直接模拟 代码: #include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); while(n--) { i…
Educational Codeforces Round 69 (Rated for Div. 2) E. Culture Code 题目链接 题意: 给出\(n\)个俄罗斯套娃,每个套娃都有一个\(in_i,out_i\),并满足\(out_i>in_i\).定义套娃\(i\)能套在套娃\(j\)里面,当且仅当\(out_i\leq in_j\). 定义极大套娃组:当且仅当不能有另外一个套娃套在它们身上. 定义套娃组额外空间为\(in_1+(in_2-out_1)+\cdots +(in_k-…