摘要: 类 - 链式前向星(封装) by 橙之夏 Code struct forstar { vector<int> _h, _e, _ne, _w; int idx = 0; forstar(int n) // 初始化,n为容量 { _h.resize(n + 1, -1), _e.resize(n + 阅读全文
posted @ 2024-03-06 20:01 橙之夏 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 代码宏定义以及框架约定 #include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // #define int long long #d 阅读全文
posted @ 2024-01-31 22:28 橙之夏 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round 916 (Div. 3) (A~E2) A. Problemsolving Log 签到题,对于给出的字符串,用数组记录每个字母出现的次数,然后遍历一边记录数组,如果对应的字母出现次数大于它的位次,则说明该字母对应的题目被解出来了,最后输出解题数量即可 void s 阅读全文
posted @ 2023-12-20 01:27 橙之夏 阅读(272) 评论(0) 推荐(0) 编辑
摘要: Educational Codeforces Round 160 (Rated for Div. 2) A. Rating Increase 纯暴力,分割字符串,如果n1<n2就输出,如果遍历完整个数组都不存在n1<n2就输出-1. const int N = 2e5 + 10; int toint 阅读全文
posted @ 2023-12-19 20:12 橙之夏 阅读(52) 评论(2) 推荐(0) 编辑
摘要: PTA数组及排序查找题解与解题思路 函数题目 函数题目为平台提供的裁判程序调用所完成的函数进行判题,题目规定语言为C语言 6-1 求出二维数组的最大元素及其所在的坐标 本题较为简单,考察的是如何遍历一个二维数组,只需要两个循环依次遍历其每个维度和元素即可 如何寻找最大值?只需要在遍历每个元素的过程中 阅读全文
posted @ 2023-10-28 01:33 橙之夏 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 7-1 判断素数 题目分析 题目输入n个数,判断其是否为质数 对于判断质数,只需要满足从2开始遍历的每一个数一直到√n均无法被n整除即可 关于为什么只要到√n呢? 因为n = √n * √n,因此其最大的因数不会超过√n,因此可以优化减少不必要的循环 AC Code #include<iostrea 阅读全文
posted @ 2023-10-18 21:41 橙之夏 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 大整数的高精度运算 加法 #include <bits/stdc++.h> using namespace std; vector<int> big_num_add(vector<int> n1,vector<int> n2) { vector<int> ans; int t=0; for(int 阅读全文
posted @ 2023-10-18 19:01 橙之夏 阅读(28) 评论(0) 推荐(0) 编辑