
数字处理
文章平均质量分 75
枫流仁武
这个作者很懒,什么都没留下…
展开
-
LeetCode 204 计数质数
统计所有小于非负整数n的质数的数量。示例 1:输入:n = 10输出:4解释:小于 10 的质数一共有 4 个, 它们是 2, 3, 5, 7 。示例 2:输入:n = 0输出:0示例 3:输入:n = 1输出:0埃氏筛,如果一个数为质数,那么该数的任意倍数就不是质数了。通过这个方法筛选。class Solution: def countPrimes(self, n: int) -> int: # 埃氏筛 isPri...原创 2020-12-03 08:19:49 · 206 阅读 · 0 评论 -
PAT 1096 Consecutive Factors
注意本题的判断条件#include <iostream>#include <vector>#include <cmath>#include <set>#include <climits>using namespace std;typedef long long LL;void find(LL N,vector<L...原创 2019-07-13 16:47:01 · 82 阅读 · 0 评论 -
PAT 1073 Scientific Notation
这题太恶心了,不想再做第二遍#include <iostream>#include <cmath>using namespace std;int main() { string s; cin>>s; int index=s.find('E'); string t=s.substr(1,index-1); in...原创 2019-07-14 13:18:39 · 84 阅读 · 0 评论 -
PAT 1002 A+B for Polynomials
This time, you are supposed to findA+BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2019-07-20 17:47:14 · 72 阅读 · 0 评论 -
PAT 1019 General Palindromic Number
A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers...原创 2019-09-03 12:40:07 · 88 阅读 · 0 评论 -
PAT 1010 Radix
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive inte...原创 2019-09-06 12:12:44 · 87 阅读 · 0 评论