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…
http://codeforces.com/problemset/problem/1073/D 题目大意:有n个物品(n<2e5)围成一个圈,你有t(t<1e18)元,每次经过物品i,如果身上的钱可以购买该物品就直接购买,直到一件物品都不能购买,求一共可以购买多少件物品. 题目分析:由于t的数量级达到了1e18,所以不可能直接进行暴力模拟,这个时候就要想到周期性地模拟. 题解:每次遍历一下1~n这n个物品,然后计算出可以取的物品数以及价值,然后用剩下的钱除以这个价值,得到可以进行的轮数,累加到…
写之前,先发表下感慨:好久没写题解了,也许是因为自己越来越急利了,也可以说是因为越来越懒了. A. Diverse Substring 直接找一找有没有相邻的两个不同的字符即可. B. Vasya and Books 分别记录书本摆放顺序$a[]$,取书顺序$b[]$,每本书的位置$pos[]$,每本书在不在书堆上$in[]$,书堆最顶端的书的位置$top$(因为用的是数组,元素位置是固定的). 然后,按照题意枚举输入的取书顺序$b[]$,同时记录答案$ans$,更新$top$即可. C. Va…
题目链接:https://codeforc.es/contest/1076 A. Minimizing the String 题意:给出一个字符串,最多删掉一个字母,输出操作后字典序最小的字符串. 题解:若存在一个位置 i 满足 a[i] > a[i+1],若不删除 a[i] 则后续操作不可能更优. #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long lo…
传送门 Div 2的比赛,前四题还有那么多人过,应该是SB题,就不讲了. 这场比赛一堆计数题,很舒服.(虽然我没打) E. The Top Scorer 其实这题也不难,不知道为什么这么少人过. 考虑枚举那人的分数和有多少人和他同分,推一下就会发现我们只需要知道\(calc(sum,n,top)\)表示\(sum\)分,分给\(n\)个人,分数小于\(top\),的方案数. 好像不是很好直接搞,考虑容斥,枚举一下至少有几个人不满足条件即可. #include<bits/stdc++.h> na…
E. Sum of Remainders 题目连接: http://www.codeforces.com/contest/616/problem/E Description The only line contains two integers n, m (1 ≤ n, m ≤ 1013) - the parameters of the sum. input The only line contains two integers n, m (1 ≤ n, m ≤ 1013) - the para…
D. Longest k-Good Segment 题目连接: http://www.codeforces.com/contest/616/problem/D Description The array a with n integers is given. Let's call the sequence of one or more consecutive elements in a segment. Also let's call the segment k-good if it conta…
C. The Labyrinth 题目连接: http://www.codeforces.com/contest/616/problem/C Description You are given a rectangular field of n × m cells. Each cell is either empty or impassable (contains an obstacle). Empty cells are marked with '.', impassable cells are…
B. Dinner with Emma 题目连接: http://www.codeforces.com/contest/616/problem/A Description Jack decides to invite Emma out for a dinner. Jack is a modest student, he doesn't want to go to an expensive restaurant. Emma is a girl with high taste, she prefer…