Codeforces Round #556 题解 Div.2 A Stock Arbitraging 傻逼题 Div.2 B Tiling Challenge 傻逼题 Div.1 A Prefix Sum Primes 傻逼题,先放2,1然后放完2然后放完1 Div.1 B Three Religions 有三个字符串\(s_1,s_2,s_3\)和一个主串\(s\),每次操作改变一个\(s_i\)(插入或删除字符),每次操作完之后问\(s\)是否可以分成\(3\)个子序列正好是\(s_1,s_…
题目 CF2B The least round way 做法 后面\(0\)的个数,\(2\)和\(5\)是\(10\)分解质因数 则把方格中的每个数分解成\(2\)和\(5\),对\(2\)和\(5\)求两边动规,得出最小值\(ans=min(num_2,num_5)\) 我们贪心地选择最小值所对应的\(2\)或\(5\),然后从\((n,n)\)按动规路径返回 Code #include<bits/stdc++.h> typedef int LL; const LL maxn=1e3+9;…
Codeforces Beta Round #62 A Irrational problem 题意 f(x) = x mod p1 mod p2 mod p3 mod p4 问你[a,b]中有多少个数满足f(x)=x 题解 显然直接带进去就好了-- 代码 #include<bits/stdc++.h> using namespace std; int main() { int p1,p2,p3,p4,a,b; scanf("%d%d%d%d%d%d",&p1,&am…
我能说我比较傻么!就只能做一道签到题,没办法,我就先写下A题的题解&源码吧,日后补上剩余题的题解&源码吧! A -- Niro plays Galaxy Note 7 Time Limit:1s Memory Limit:128MByte DESCRIPTION Niro, a lovely girl, has bought a Galaxy Note 7 and wants to…
Codeforces Global Round 2 题目链接:https://codeforces.com/contest/1119 A. Ilya and a Colorful Walk 题意: 给出n个数,问从一个数到另外一个不同数的最长距离是多少. 题解: 从前往后,从后往前扫两遍即可.证明可用反证法,这里略去. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int n; int c[N]; i…
今天做题运气出奇的好,除了几处小错误调试之后忘记改掉了……最后还AK了……虽然题目不难,学长也说是福利局,但是对个人的鼓励作用还是挺大的……至此暑假训练就结束了,也算没有遗憾……. 题解如下: Problem A: 苦逼的MCA Time Limits: 1000 MS Memory Limits: 65536 KB 64-bit interger IO format: %lld Java class name: Main Description 在TUBN这个地方,有个苦逼的人…
A:DESCRIPTION Eric has an array of integers a1,a2,...,ana1,a2,...,an. Every time, he can choose a contiguous subsequence of length kk and increase every integer in the contiguous subsequence by 11. He wants the minimum value of the array is at least…
B. The least round way time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that star…
A. Vicious Keyboard 题意:给你一个字符串,里面只会包含VK,这两种字符,然后你可以改变一个字符,你要求VK这个字串出现的次数最多. 题解:数据范围很小,暴力枚举改变哪个字符,然后check就好. #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans = 0; for(int i=0;i<s.size();i++){ if(s[i]=='V'){…
A. k-Factorization 题意:给你一个n,问你这个数能否分割成k个大于1的数的乘积. 题解:因为n的取值范围很小,所以感觉dfs应该不会有很多种可能-- #include<bits/stdc++.h> using namespace std; long long n; int k; vector<int> ans; void dfs(int x,long long now,int st){ if(x==k&&now==n){ for(int i=0;i…
写之前,先发表下感慨:好久没写题解了,也许是因为自己越来越急利了,也可以说是因为越来越懒了. A. Diverse Substring 直接找一找有没有相邻的两个不同的字符即可. B. Vasya and Books 分别记录书本摆放顺序$a[]$,取书顺序$b[]$,每本书的位置$pos[]$,每本书在不在书堆上$in[]$,书堆最顶端的书的位置$top$(因为用的是数组,元素位置是固定的). 然后,按照题意枚举输入的取书顺序$b[]$,同时记录答案$ans$,更新$top$即可. C. Va…
Problem A. Neverending competitions 题目大意 一个团队有多个比赛,每次去比赛都会先订机票去比赛地点,然后再订机票返回.给出\(n\)个含有起止地点的购票记录(不按时间顺序),判断这个团队是否返回. 题解 竞速题 因为每次比赛都必定是一去一返 所以当订票记录个数为偶数的时候一定在家中,否则一定在比赛. Code a = input() if a % 2 == 0: print 'home' else: print 'contest' Problem B. Cod…
题目链接 Codeforces Educational Round 33 Problem A 按照题目模拟,中间发现不对就直接输出NO. #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a); i >= (b); --i) #define MP make_pair #de…
[题解] 可以发现10的因数除了1和10之外只有2和5了,那么走过的路径上各个数字的2的因数个数之和.5的因数个数之和中较小的一个即是答案.这样的话DP即可.同时需要注意有0的情况,有0的时候有一个答案为1,要和前面求出的答案取较小值. #include<cstdio> #include<algorithm> #define LL long long #define rg register #define N 1010 using namespace std; int n,m,px…
这场比赛让我上橙了. 前三题都是大水题,不说了. 第四题有点难想,即使想到了也不能保证是对的.(所以说下面D的做法可能是错的) E的难度是 $2300$,但是感觉很简单啊???说好的歪果仁擅长构造的呢??? 这次超常发挥过头了,下次肯定要掉了QwQ. A 水题.不过分类讨论有点难受,结果8min才交,被别人甩了一大截. 时间复杂度 $O(1)$. #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef…