摘要: 7-1 判断素数 题目分析 题目输入n个数,判断其是否为质数 对于判断质数,只需要满足从2开始遍历的每一个数一直到√n均无法被n整除即可 关于为什么只要到√n呢? 因为n = √n * √n,因此其最大的因数不会超过√n,因此可以优化减少不必要的循环 AC Code #include<iostrea 阅读全文
posted @ 2023-10-18 21:41 橙之夏 阅读(358) 评论(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 橙之夏 阅读(82) 评论(0) 推荐(0)