随笔分类 - 刷题笔记: CF
摘要:A - Two Substrings You are given string s. Your task is to determine if the given strings contains two non-overlapping substrings "AB" and "BA" (the s
阅读全文
摘要:Educational Codeforces Round 93 (Rated for Div. 2) A. Bad Triangle input 3 7 4 6 11 11 15 18 20 4 10 10 10 11 3 1 1 1000000000 output 2 3 6 -1 1 2 3 N
阅读全文
摘要:思路:这道题是对于一串数字,每给定一个位置,就指出从这个位置往右一直到最后一个元素之间有多少不重复的数字。 涉及到数字重复问题,想到用map处理。再用动态规划,从后往前依次加一或者不变既可。 #include<iostream> #include<cstring> #include<algorith
阅读全文
摘要:Example input 6 3 1 4 2 10 3 10 2 16 4 16 5 output YES YES NO YES YES NO 解题思路:首先我们应该知道:偶数个奇数相加一定是偶数,奇数个奇数相加一定是奇数,所以对于给出的n和k,如果n是偶数,k是奇数,或者n是奇数,k是偶数,n和
阅读全文
摘要:Recall that the sequence b is a a subsequence of the sequence a if b can be derived from a by removing zero or more elements without changing the orde
阅读全文
摘要:Codeforces Round #628 (Div. 2) A. EhAb AnD gCd Description 给定一正整数 ,求正整数 ,使得 。 Solution 取 即可。 #include<bi
阅读全文
摘要:1395A - Boboniu Likes to Color Balls 如果在r,b,g,w中小于或等于一个奇数,则可以将其定为回文。 否则,请进行一次操作(如果可以),然后检查上述情况。 进行多次操作是没有意义的,因为我们只关心r,b,g,w的奇偶性 #include<bits/stdc++.h
阅读全文
摘要:原题链接:https://codeforces.com/problemset/problem/670/C 题目大意: 有 n 个人,每人会且仅会一种语言. (n ≤ 2e5) 语言有各自的编号(≤ 1e9) 这些人去看电影,一共有 m 种电影. (m ≤ 2e5) 每个电影的声音与字幕语言都不一样.
阅读全文
摘要:题目链接:http://codeforces.com/problemset/problem/1191/B 题意:类似于麻将,三个一样花色一样数字的,或者三个同花顺就赢了,新抽的能当任何类型,问至少几个。 思路:分类判断即可。 AC代码: #include<bits/stdc++.h> using n
阅读全文
摘要:https://codeforces.com/problemset/problem/466/C 解题说明:此题是一道数学题,若平分分成若干种情况,应当整体(sum)考虑,对sum/3进行分析。它是区分3段的标准。 所以当部分和tmp=sum/3,部分统计加一。 当 tmp==sum*2/3,则全部统
阅读全文
摘要:https://codeforces.com/problemset/problem/711/A 正则表达式基本应用 #include<bits/stdc++.h> using namespace std; int n, i; string s, t; int main() { //freopen("
阅读全文
摘要:CF 1374A. Required Remainder You are given three integers x,y and n. Your task is to find the maximum integer k such that 0≤k≤n that kmodx=y, where mo
阅读全文
摘要:这一次的Div.2 大多数学思维。。 A. Park Lightingtime https://codeforces.com/contest/1358/problem/A 题意:给一个n,m为边的矩形,问最少的灯使得整个矩形照亮 思路:n * m 为总区域数一个灯最多能照亮两块区域,贪心做:每次都取
阅读全文
摘要:A.Common Subsequence 题意 给你两组数,问你有没有相同 的书,有的话,输出最短的那组(大家都知道,1是最小的) AC #include<bits/stdc++.h> using namespace std; const int N = 1005; int a[N], x, n,
阅读全文
摘要:https://codeforces.com/problemset/problem/455/A 题意: 给出n个元素,让我们来挑选,如果选了 ,获得 点数,同时与 相等的元素都要被删除,问选完所有元素后的所能获得的最大点数 解题思路: 首先输
阅读全文