首页 > TAG信息列表 > cnta

「JOISC 2020 Day1」建筑装饰 4

题意: \(2n\)个位置,给长度为\(2n\)的序列A,B。问每一位置在\(A\)和\(B\)中任选一个,恰好\(n\)个A和B,得到不降的序列\(C\)的方案(多种任意输出一种)。 思路: 引理 猜了一个结论:能够造出C的A的个数是连续的。 和CF之前打过一道题,一样的技巧。 这里给简略构造证明: 处理出A个数最少(Amin

NC24622 Brownie Slicing

NC24622 Brownie Slicing 题目 题目描述 Bessie has baked a rectangular brownie that can be thought of as an RxC grid (1 <= R <= 500; 1 <= C <= 500) of little brownie squares. The square at row i, column j contains \(N_{ij}\) (0 <= \(N_{ij}\) &l

CF1475C Ball in Berland 题解

题意 有 \(a\) 个男孩,\(b\) 个女孩,组成了 \(k\) 对舞伴,问选出这 \(k\) 对舞伴中的两对且两对舞伴中的 \(4\) 个人互不相同的方法数。 分析 假设第 \(i\) 对舞伴由男孩 \(a[i]\) 和女孩 \(b[i]\) 组成,用 \(cnta[a[i]]\) 和 \(cntb[b[i]]\) 分别记录 \(a[i]\) 号男生出现的次数和 \(

[USACO05JAN] Muddy Fields G

\(Soution\) 把木板看成一个点,把 \(*\) 看成一条边,因为一个 \(*\) 最多对应两块木板,现在问题转化成了二分图上的最小点覆盖问题,众所周知二分图上最小点覆盖等于最大匹配 \(Code\) #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 250

1060 Are They Equal (25 分)(科学计数法)

If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple chopping. Now given the number of significant digits on a machine and two float numbers, you are s

1046 划拳 (15 分)

水题~ int n; int main() { cin>>n; int cnta=0,cntb=0; for(int i=0;i<n;i++) { int a,suma,b,sumb; cin>>a>>suma>>b>>sumb; if(suma == a+b && sumb != a+b) cntb++; if(sumb =

如何找出数组里出现次数超过总数1/3的数 Java实现

数组里出现次数超过总数1/3的数最多有两个。 三个不相同的数字为一组,删掉每一组。剩下的就是出现次数超过总数1/3的数。 import java.util.ArrayList; import java.util.List; class Solution { public List<Integer> majorityElement(int[] nums) { ArrayList<

codeforces1451 C. String Equality

真的弱,这题都想蹦了。 这场md,b题看错题调了1小时才发现,c题上来也看错。。最后懒得写了睡觉~ C. String Equality 神的讲解 注意到连续k个相同字符才能使用操作二,不过我们可以交换,由此不难知道是否能够交换之和出现次数有关。再加上我们只能够+1由此从小到大考虑每个字符的出