摘要: Sample Input 5 4 0 0 1 3 1 4 3 5 4 5 5 4 1 0 1 3 1 4 3 5 4 5 2 Sample Output NO YES题意:有n个人,有m场比赛,有x个好人,y个坏人,需要根据下面的m场比赛,确认是否可以将n个人划分为好人还是坏人。不一定要知道这个人到 阅读全文
posted @ 2020-03-04 21:43 Tangent_1231 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Sample Input 6 8 798 10780 Sample Output No Solution 308 490题意:给出a,b两个数字,问是否存在x,y,使得x+y=a,lcm(x,y)=b。找不到输出“No Solution”思路:大佬队友写出来的。x+y=a,x*y/gcd(x,y)= 阅读全文
posted @ 2020-03-04 21:35 Tangent_1231 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Input 3 8 5 11011010 7 9 1111100 7 11 1111100 Output 01011110 0101111 0011111题意:t组样例,给一个长度为n的字符串,要求在k步以内进行字符交换(1步只能交换i和i+1)使得字符串字典序最小。思路:贪心,存下0的位置,让前面 阅读全文
posted @ 2020-03-04 21:31 Tangent_1231 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Input 4 5 1 2 1 2 1 3 30 20 10 5 1 2 2 3 4 9 3 1 4 1 5 9 2 6 5 Output 1 1 4 5 题意:输入一个n表示天数,下一行跟着长度为n的数组a表示第i天的题目难度a[i]。我们想找到aj-ai=ak-aj成立的式子。 做法:使用uno 阅读全文
posted @ 2020-03-04 21:10 Tangent_1231 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Example Input 5 3 1 3 2 3 3 4 0 5 2 Output 4 5 6 0 12题意:给出01字符串的长度,告诉1的数量,求包含1区间的个数。思路:先求出全部区间的数量,然后贪心的想用1把0全部平均分割开,然后减去只有0组合在一起的数量。 #include<iostream 阅读全文
posted @ 2020-03-04 21:00 Tangent_1231 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题意:给一个n*m的01矩阵,求全为1的最大子矩阵。 1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 #include<cstring> 5 #include<queue> 6 #include<set> 7 #incl 阅读全文
posted @ 2020-03-04 20:44 Tangent_1231 阅读(193) 评论(0) 推荐(0) 编辑