摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 1000000 + 5; #define MaxSize 50 typedef struct{ int data[MaxSize]; int 阅读全文
posted @ 2022-05-06 22:21 阿涅—Rachel 阅读(47) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: 给定一个单链表,其中的元素按升序排序,将其转换为高度平衡的二叉搜索树。 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。 示例: 给定的有序链表: [-10, -3, 0, 5, 9], 一个可能的答案是:[0, -3, 9, -10 阅读全文
posted @ 2021-04-20 13:57 阿涅—Rachel 阅读(122) 评论(0) 推荐(0)
摘要: 在m*n的矩阵中,非零元素个数为t,∂=t/(m*n),称∂为矩阵的稀疏因子,当∂<=0.05称矩阵为稀疏矩阵。为了节省空间,可以用三元组来存储稀疏矩阵。三元组记录矩阵非零值的行、列、值。 在求矩阵的转置矩阵时,可以用快速转置方法来节省时间。 #include<bits/stdc++.h> #inc 阅读全文
posted @ 2021-04-13 09:24 阿涅—Rachel 阅读(304) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: Input: The first line of the input contains two integers nn and mm (1≤n,m≤2⋅105,n⋅m≤2⋅1051≤n,m≤2⋅105,n⋅m≤2⋅105) — the size of the matrix. T 阅读全文
posted @ 2021-04-06 20:52 阿涅—Rachel 阅读(41) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: 给定四个正整数a,b,c,k,回答是否存在一个正整数n,使得a*n在k进制表示下的各位的数值之和模b为c。 输入描述: 第一行一个整数T(T <= 5,000)。 接下来T行,每行四个正整数a,b,c,k(1 ≤ a ≤ 10^18; 2 ≤ k ≤ 10^18; 0 ≤ c 阅读全文
posted @ 2021-03-18 20:44 阿涅—Rachel 阅读(79) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: Polycarp was gifted an array aa of length nn . Polycarp considers an array beautiful if there exists a number CC , such that each number in 阅读全文
posted @ 2021-02-23 14:37 阿涅—Rachel 阅读(146) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: 矩阵 M 包含 R 行 C 列,第 i 行第 j 列的值为 Mi,j。 请寻找一个子矩阵,使得这个子矩阵的和最大,且满足以下三个条件: 子矩阵的行数不能超过 X 行。 子矩阵的列数不能超过 Y 列。 子矩阵中 0 的个数不能超过 Z 个。 请输出满足以上条件的最大子矩阵和。 I 阅读全文
posted @ 2021-02-20 17:08 阿涅—Rachel 阅读(240) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: 小西有一条很长的彩带,彩带上挂着各式各样的彩珠。已知彩珠有N个,分为K种。简单的说,可以将彩带考虑为x轴,每一个彩珠有一个对应的坐标(即位置)。某些坐标上可以没有彩珠,但多个彩珠也可以出现在同一个位置上。 小布生日快到了,于是小西打算剪一段彩带送给小布。为了让礼物彩带足够漂亮, 阅读全文
posted @ 2021-02-20 15:20 阿涅—Rachel 阅读(59) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: A championship is held in Berland, in which nn players participate. The player with the number ii has a_iai​ ( a_i \ge 1ai​≥1 ) tokens. The 阅读全文
posted @ 2021-02-20 09:26 阿涅—Rachel 阅读(119) 评论(0) 推荐(0)
摘要: 题目链接 题目描述: Input: 第一行输入数据组数T对于每组数据,第一行为一个整数n,表示序列长度接下来一行有n个数,表示序列内的元素 Output: 对于每组数据,输出一个整数表示答案 Example: Input: 334 2 351 8 4 3 9202 8 15 1 10 5 19 19 阅读全文
posted @ 2021-02-18 18:16 阿涅—Rachel 阅读(67) 评论(0) 推荐(0)