随笔分类 - 数学—计数原理与排列组合
摘要:题意: 对于一个数组,可以删除当且仅当,删除后这个位置后面的数将向前平移。现在给定和,问有多少个长度不超过,元素不超过的数组,存在不止一种的清空方式。 考虑长度固定为时的答案。正难则反,可以求出总数量然后减去只有一种
阅读全文
摘要:An integer sequence with length 𝑛n, denoted by 𝑎1,𝑎2,⋯,𝑎𝑛a1,a2,⋯,an, is generated randomly, and the probability of being 1,2,⋯,𝑛1,2,⋯,n are all
阅读全文
摘要:Your task is to calculate the number of arrays such that: each array contains 𝑛n elements; each element is an integer from 11 to 𝑚m; for each array,
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/21791/F 来源:牛客网 题目描述 给你两个数字 a a和 b b。一个数是由 a,b a,b两种数字构成,那么这个数是good;这个数的每一位加起来构成新的一个数,并且新数也是一个good数,那么称原数为excell
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/21791/E 来源:牛客网 题目描述 岛上有三种颜色的岛屿,分别是红色、蓝色和紫色。岛群分别由 a , b a,b和 c c个不同的岛组成。 在一些(可能全部或没有)岛屿之间建立了桥梁。一座桥双向连接两个不同的岛,长度为
阅读全文
摘要:The World is a Theatre time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n boys
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11256/D 来源:牛客网 题目描述 Given two strings A,BA,B, and little H wants to choose a subsequence from {1,2,⋯ ,∣A∣}{1,2,
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11254/J 来源:牛客网 题目描述 Goodeat finds an undirected complete graph with n vertices. Each edge of the graph is paint
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11213/C 来源:牛客网 题目描述 小F对杨辉三角颇有研究,他把杨辉三角第nn行的数提出来,从左到右分别为a[0],a[1],...,a[n−1]a[0],a[1],...,a[n−1]。 现在他想知道∑i=0n−1i
阅读全文
摘要:Cirno gave AquaMoon a chessboard of size 1×𝑛1×n. Its cells are numbered with integers from 11 to 𝑛n from left to right. In the beginning, some of th
阅读全文
摘要:Problem Statement Given is a sequence A of N integers. There are 2N−1 non-empty subsequences B of A. Find the sum of max(B)×min(B) over all of them. S
阅读全文
摘要:A. 回文括号序列计数 坑比题...注意回文的定义,并不是括号序列对称。比如(())不是回文的而))是回文的。而合法括号列左右两端一定是(和),必然非回文,因此只有空串答案是1. #include <iostream> using namespace std; #define mod 9982443
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/9985/B 来源:牛客网 题目描述 众所周知,天姐姐只喜欢天下最聪明的人,为了找到这样的人,她决定比武招亲! 只见天姐姐在榜上留下了这样一道问题,谁做出来了就可以俘获她的芳心! 爱慕天姐姐已久的泽鸽鸽问询赶来,只见榜上写
阅读全文
摘要:动物园里饲养了很多动物,饲养员小 A 会根据饲养动物的情况,按照《饲养指南》购买不同种类的饲料,并将购买清单发给采购员小 B。 具体而言,动物世界里存在 2k 种不同的动物,它们被编号为 0∼2k−1。动物园里饲养了其中的 n 种,其中第 i 种动物的编号为 ai。 《饲养指南》中共有 m 条要求,
阅读全文
摘要:Binary Search Andrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After
阅读全文
摘要:Boring Apartments 模拟 #include <iostream> using namespace std; int main() { //freopen("data.txt", "r", stdin); int t; cin >> t; while(t--) { int x; cin
阅读全文
摘要:There is a piece of paper in rectangular shape with sufficient length and width (lay flat on the table). Execute an operation instruction according to
阅读全文
摘要:There are n members in our ACM club. Little W wants to select three persons from our club to form a new team taking part in provincial ACM contests, a
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int a[1005][1005] = {0}, n, m; int main() { int t; cin >> t; while(t--) { memset(a, 0, sizeof(a)); cin >
阅读全文
摘要:Cuber QQ 迎来了他在华师大的最后一次期末考试。由于情况特殊,这场考试改为线上进行。 这是为毕业班特别准备的一次期末考试,命题老师为了让各位考生顺利毕业,设计了如下考试规则: 期末考试试卷共 n (1≤n≤1000)道选择题,由单选题和多选题组成。每道题的选项个数可能不同,多选题保证至少有一个
阅读全文