- 博客(8)
- 收藏
- 关注
原创 高精度算法
高精度加法:#include<bits/stdc++.h>using namespace std;const int maxnn = 505;char a1[maxnn], b1[maxnn];int a[maxnn], b[maxnn], c[maxnn];int main(){ cin >> a1 >> b1; int t1 = strlen(a1), t2 = strlen(b1); for(int i = 1; i <= t1; i++
2022-02-15 08:39:29
316
原创 栈 (stack) || 队列 (queue)
栈 stack:定义栈:stack <int> st;栈的用法:st.push(in); 向栈中压入一个元素 st.pop(); 删除栈顶元素 st.size(); 返回栈中元素数量 st.empty(); 如果栈为空,返回true st.top(); 返回栈顶元素值(不删除) 栈的有关题目:简单的:https://www.luogu.com.cn/problem/P1427https://www.luogu.com.cn
2022-01-19 17:33:14
4655
原创 筛质数方法 || 埃氏筛质数
1.基础筛质数(复杂度O(n)):上代码:#include<bits/stdc++.h>using namespace std;long long n;bool q(int t){ for(int j = 2; j < t; j++){ if(t % j == 0 && t != 2) return 0; } return 1;}int main(){ cin >> n; for(int i = 2; i <=
2022-01-17 20:16:49
179
原创 前缀表达式、中缀表达式、后缀表达式的异同
前缀表达式(波兰式):什么是前缀表达式呢?定义:https://baike.baidu.com/item/%E5%89%8D%E7%BC%80%E8%A1%A8%E8%BE%BE%E5%BC%8F/5461072?fr=aladdin简单来说,前缀表达式是一种算术表达式,它不需要括号就可以进行有括号的运算,并且运算符在前, 操作符在后.运算:如何对前缀表达式进行计算呢?可以用 压栈法:从右往左遍历,如果当前字符(或字符串)为数字或变量,则压入栈内;...
2021-09-12 12:04:34
306
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人