摘要: 【前置知识】矩阵乘法、点乘的计算以及点积和叉积的分辨 上面这个是矩阵乘法和Hadamard product哈达玛积的计算。 常见的product(积)有很多种: 1.inner product/outer product内积/点积 2.Matrix product矩阵乘法 这个就是[0,0]=[0, 阅读全文
posted @ 2025-12-02 16:15 q_z_chen 阅读(32) 评论(0) 推荐(0)
摘要: attention:set<pair<int,int>>可以直接比较; 另外,由于这个矩阵实际上是读取逻辑上下颠倒了一下,从S开始即可; 暴力遍历所有的小矩阵块; 代码如下: #include<iostream> #include<set> #include<vector> using namesp 阅读全文
posted @ 2025-12-02 13:30 q_z_chen 阅读(6) 评论(0) 推荐(0)
摘要: 关键是读题,发现该给出的输入其实是矩阵第一列为1; 然后,按照4x4下落; 并且 加上虚拟边界,在15行下面加上4行全部都是1111的行,这样就可以不判断方块到底在矩阵的哪里直接写find_row从0-14了; 代码如下: #include<iostream> #include<vector> us 阅读全文
posted @ 2025-12-02 12:18 q_z_chen 阅读(7) 评论(0) 推荐(0)
摘要: 代码如下: #include<iostream> #include<vector> #include<cmath> using namespace std; double n; double avg_a; double Da; double f(double a){ return (a-avg_a) 阅读全文
posted @ 2025-12-02 11:01 q_z_chen 阅读(10) 评论(0) 推荐(0)
摘要: 没什么好说的,数学规律,代码: #include<iostream> #include<vector> using namespace std; int n; vector<int> num; int main(){ cin >> n; for(int i =0; i < n;i++){ int t 阅读全文
posted @ 2025-12-01 21:31 q_z_chen 阅读(4) 评论(0) 推荐(0)
摘要: 小模拟,简单遍历; 进行两次遍历求每行每列可以消除的部分,时间复杂度为O(n^2); RTE点:vector<vector<int>> matrix(n+1,vector<int>(m+1));别把n,m写错了; 其他: 使用【map】mpROW和mpCOL来存行和列的可以消除的点,并且只存末尾的点 阅读全文
posted @ 2025-12-01 20:58 q_z_chen 阅读(8) 评论(0) 推荐(0)
摘要: 没什么好说的,就是一个取余和除法的关系; 代码: #include<iostream> using namespace std; int main(){ int num; cin >> num; int sum = 0; while(num/10 > 0){ int temp = num%10; s 阅读全文
posted @ 2025-12-01 20:03 q_z_chen 阅读(4) 评论(0) 推荐(0)
摘要: 死算出来了所有月份的范围,然后计算d和每个月份开始的差值就可以了: 闰年: The number 1 month is from 1 to 31 The number 2 month is from 32 to 59 The number 3 month is from 60 to 90 The n 阅读全文
posted @ 2025-12-01 19:58 q_z_chen 阅读(12) 评论(0) 推荐(0)
摘要: 比较简单 代码如下: #include<iostream> using namespace std; int main(){ int n; cin >> n; int sum = 0; int prev; for(int i = 0;i < n;i++){ int temp; if(i ==0){ 阅读全文
posted @ 2025-12-01 18:28 q_z_chen 阅读(43) 评论(0) 推荐(0)
摘要: 使用map和遍历的特性,时间复杂度大概是小于等于O(n^2); 代码:```cpp include include using namespace std; int n; map<int,int> mp; int main(){ cin >> n; for(int i = 0;i < n;i++){ 阅读全文
posted @ 2025-12-01 18:07 q_z_chen 阅读(3) 评论(0) 推荐(0)