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…
A. Vasya and Book time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is reading a e-book. The file of the book consists of nn pages, numbered from 11 to nn. The screen is currently disp…
D. Vasya And The Matrix time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teache…
题意:当前在看书的第 x 页,每次可以向前或者向后翻 d 页,这个书一共 n 页,问能否用最小操作翻到第 y 页. 题解:三种情况:1.直接翻能到的一定最短. 2.先翻到第一页,然后往后翻,翻到第 y 页.3.先翻到第 n 页,然后往前翻,翻到第 y 页. #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int ans,t,n,x,y,d; cin >> t; while…
题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍),问要获得长度为n的串所需最少的时间. 思路:dp[i]表示获得长度为i的串所需要的最短时间,分i为奇数和偶数讨论. #include<bits/stdc++.h> using namespace std; const int N=1e7+3; typedef long long ll; ll…
E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output You are given a functional graph. It is a directed graph, in which from each vertex goes exactly o…
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line…