CF的Educational Round (Div.2),质量还是蛮高的. A: 水题 #include<cstdio> #include<algorithm> typedef long long ll; ll T,x,y,k,ans; template <typename T> inline void read(T &x){ char ch = getchar(); x = 0; int f = 1; for(;ch > '9' || ch < '…
题意:你和基友两人从左往右轮流打怪兽,强怪用\(1\)表示,垃圾用\(0\)表示,但基友比较弱,打不过强怪,碰到强怪需要用一次魔法,而你很强,无论什么怪都能乱杀,基友先打,每人每次至少杀一个怪兽,最多杀两个怪兽,问最少需要用多少次魔法能将怪兽全部打完. 题解:由于在打怪的过程中,每个状态都与之前息息相关,所以我们可以用dp来写,\(dp[i][who]\),\(i\)表示第\(i\)个怪兽,\(who\)表示我或基友,因为基友先打,所以基友的前两个状态我们是确定的,即:\(dp[1][0]=a[…
题意:给你一串长度为\(n\)的序列,有的位置被锁上了,你可以对没锁的位置上的元素任意排序,使得最后一个\(\le0\)的前缀和的位置最小,求重新排序后的序列. 题解:贪心,将所有能动的位置从大到小排个序就行了. 代码: struct misaka{ int a; int loc; }e[N]; int t; int n; int main() { //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); t=read(); while(t--)…
题意:刚开始你有一个木棍,造一个火炬需要一个木根和一个煤块,现在你可以用一个木棍换取\(x\)个木棍,或者\(y\)根木棍换一个煤块,消耗一次操作,问最少需要操作多少次才能造出\(k\)把火炬. 题解:初始你有一个木棍,造出\(k\)把火炬需要\(k\)个木棍和\(k\)个煤块,而一个煤块需要\(y\)个木棍,所以需要木棍\(k+y*k-1\)个,而每次操作你可以获得\(x-1\)个木棍,所以为了获得木根,需要操作\(\lceil k+y*k-1/(x-1)\rceil\),之后获得\(k\)个…
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…