2020.1.30--vj补题】的更多相关文章

果然是力扣杯,难度较于平时周赛提高了不少,个人感觉最后两题并不太容易QAQ LCP 18.早餐组合 #二分思想 题目链接 题意 你获得了每种主食的价格,及每种饮料的价格,你需要选择一份主食和一份饮料,且花费不超过\(x\)元.现要求购买方案数. 分析 先分别对主食与饮料进行排序.枚举主食的价格,得出饮料最高价格,再二分寻找这一价格对应的饮料编号,小于该编号的饮料均能够与当前主食进行搭配.同理,枚举饮料价格,再二分对应主食价格.时间复杂度为\(O(nlogn)\).速度并不快,可以用空间换取时间,…
A.CodeForces-124A (简单数学题) #include<cstdio> #include<algorithm> #include<iostream> #include<cmath> using namespace std; int main(){ int a,b,n; scanf("%d %d %d",&n,&a,&b); if((n-a)>b){ printf("%d",b…
C - Win or Freeze CodeForces - 151C 题目内容: You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any…
A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C stands H. …
慢慢来. 题目册 题目 A B C D tag math strings greedy dp 状态 √ √ √ √ //∅,√,× 想法 A. CME res tp A 题意:有\(n\)根火柴,额外填上\(k(k≥0)\)根火柴棍,使得\(n+k\)能分成三份\(a,b,c\),每份至少有一根火柴,满足\(a+b = c\),问\(k\)最小是多少 满足方程 \(a+b+c = n+k\) \(a + b = c\) 得\(2*c = n+k\) 若\(n\)是偶数,那么\(k\)为零,反之\…
A - Marks CodeForces - 152A 题意:给出一个学生人数n,每个学生的m个学科成绩(成绩从1到9)没有空格排列给出.在每科中都有成绩最好的人或者并列,求出最好成绩的人数 思路:求每列成绩中最大的数的个数.求出每列成绩中的最大值,遍历每列的各行若值与最大值一样就用另一个数组标记出来,最后遍历标记数组记录下总个数,即为最终结果. 代码: #include<bits/stdc++.h> using namespace std; int main() { int n,m; cin…
D - D CodeForces - 743A Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympiad. V…
B - B Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters. Let A be a set of positions in the string. Let's call it pretty if following conditions are met: lett…
D - Drinks Choosing Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated? There are nn students living…
B - A Tide of Riverscape 题意:给出一组字符串,由'0','1',' . '组成,' . '可以换成 0或1,判断第 i  个和第 i+p 个字符是否可以不相等,如果可以则输出满足条件的字符串 题解:先把所有的' . '换成0或1,在判断 i 和i+p 以及i 和 i-p 是否一样,一样则把原来的' . '换成相反的1 或0 ,最后判断是否有一组周期为p的点不同 #include<bits/stdc++.h> using namespace std; int main(…