Codeforces Round #577 (Div. 2)  D. Treasure Hunting 这个一场div2 前面三题特别简单,这个D题的dp还是比较难的,不过题目告诉你了只能往上走,所以还是可以看出来这个是一个dp的. 然后对于每一段,肯定是从左到右或者从右到左这个是最优的,这里就是有一点点贪心的思想. 所以要我们首先要求出每一行的最大最小,然后就是开始转移. 题目要求只有一部分的列才可以竖直方向的走,这个让我就有点迷糊. 首先每一段向下转移,如果这个位置向下转移到的那个位置直接有…
A. Important Exam 水题 #include<iostream> #include<string.h> #include<algorithm> #include<stdio.h> using namespace std; ; char a[maxx][maxx]; int pre[maxx]; int b[maxx]; int main(){ int n,m; while(~scanf("%d%d",&n,&…
网上题解比较少,自己比较弱研究了半天(已经过了),希望对找题解的人有帮助 题目链接:https://codeforc.es/contest/1201/problem/D 题意: 给你一个矩形,起始点在(1,1),在给定坐标有宝物,你要将整个图中的宝物全部拿到,而且你不能向下走(左右随意),而且只有在所给出的列上你才能向上走,问最少要走多少格 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); #include <cstdio>//spri…
A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A Description Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the…
题意:给你3个字符串,3个人各对自己的字符串执行n轮操作,每一次选择一个字符变为任意一个和原来不同的字符.最后问你谁能使自己的串中的任意重复子串出现的次数最大化. 显然只需关注字符而非子串. 枚举每个字符,尽力使其他字符变成它. 只有一种情况需要注意!如果字符a的出现次数等于len,并且n=1,那么你不得不将一个字符a变为其他的字符,最终最多只能有len-1个a. #include<cstdio> #include<algorithm> #include<cstring>…
比赛链接:https://codeforc.es/contest/1201 A. Important Exam 题意:有\(n\)个人,每个人给出\(m\)个答案,每个答案都有一个分值\(a_i\),每个问题的正确答案不确定,询问最大可能的得分为多少. 分析:对于每个问题贪心最大数量就好. AC代码: #include <bits/stdc++.h> #define SIZE 500007 #define rep(i, a, b) for(int i = a; i <= b; ++i)…
题意:给你一个长度为奇数\(n\)的序列.你可以对任意元素加上\(k\)次\(1\),求操作后的中位数最大. 题解:先对序列进行排序,然后对中位数相加,如果中位数和后面的元素相等,就对后面所有和当前中位数相等的元素++,然后再对中位数++,不断往复这个过程就好了,具体看代码. 代码: int n; ll k; ll a[N]; ll cnt[N]; int main() { ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); cin>>n&g…
题意:就是给一n(奇数)个元素数组,可以对它的元素执行k次+1操作,递增排序,求中位数最大是多少. 那我们在排完序之后,中位数前的元素可以不管它,只要对中位数后的操作就行,我们要判断和中位数相等的元素有几个,再用k减去它,循环一下,当k小于0时没的减了,也就是数组元素不能再加了时跳出来. 附ac代码: 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<cmath> 5…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…