大意: 给定两个字符串$a,b$, 每个字符为$0-9$, 每次操作将$a$中相邻两位加$1$或减$1$, 操作后每个数仍要为$0-9$, 求最少操作使$a$变成$b$. 先不考虑范围, 判断是否成立. 然后暴力输出方案即可 #include <iostream> #include <cstdio> #define REP(i,a,n) for(int i=a;i<=n;++i) using namespace std; typedef long long ll; const…
今天,开博客,,,激动,第一次啊 嗯,,先来发水题纪念一下 D1. Magic Powder - 1   This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you fin…
Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n…
Rock... Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows. A positive integer n is decided first. Both Koyomi a…
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one.. There is a glob pattern in the statements (a string consis…
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added…
传送门:https://codeforces.com/contest/691/problem/F 题意:给你n个数和q次询问,每次询问问你有多少对ai,aj满足ai*aj>=q[i],注意 a*b 与 b*a是不同的 题解:sum[i]记录的是两个数乘积为i的方法数,然后前缀和记录小于等于乘积为i的方法个数,输出答案就容斥一下,因为n个数最多组成n*(n-1)/2对数,减去小于乘积为q[i]的数后即为乘积大于等于q[i]的方法个数 为什么可以暴力是因为注意到了值域的范围为3e6,调和级数的复杂度…
题目链接 题意: 给定一个字符串,最多更改一个字符,问最多可以有多少个“VK”子串? 思路: 由于数据量很小,不妨尝试暴力写.首先算出不更改任何字符的情况下有多个VK字串,然后尝试每一次更改一个位置的字符,然后暴力算出有多少个VK,取出这些答案中 的最大值,即是答案. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <c…
http://codeforces.com/problemset/problem/548/B Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column n…
题意: 给你一个区间[l,r],让你从小到大输出k^x,设y=k^x,要保证y在区间[l,r]中 题解: 就算k是最小的2也不需要枚举多少次就到long long的极限了,所以暴力没商量,根本不会TLE 然后就是爆long long处理,比如r特别大,当k^x=<r但是k^(x+1)就爆long long了,这个要注意一下 代码: 1 #include<stdio.h> 2 #include<string.h> 3 #include<iostream> 4 #in…