一:判定质数 要判断一个数是不是质数,只需遍历小于等于它的所有数,如果它能被除了1和本身之外的数整除,那么它就不是质数。 很简单,暴力枚举,代码如下: 1 bool is_prime(int x) 2 { 3 if (x < 2) return false; 4 for (int i = 2; i ...
分类:
其他好文 时间:
2019-11-28 11:48:52
阅读次数:
80
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5+10; int a[N]; int n; bool prime(int x) {//判断是否为质数 for(int i = 2; ...
分类:
其他好文 时间:
2019-11-28 01:33:53
阅读次数:
97
Pairs Forming LCM (LightOJ 1236)【简单数论】【质因数分解】【算术基本定理】(未完成) 标签: 入门讲座题解 数论 题目描述 Find the result of the following code: ...
分类:
其他好文 时间:
2019-11-27 12:21:00
阅读次数:
76
题意 https://vjudge.net/problem/CodeForces-1228C 首先先介绍一些涉及到的定义: 定义prime(x)表示x的质因子集合。举例来说,prime(140)={2,5,7},prime(169)={13}。 定义g(x,p)表示存在一个最大的k∈N?,使得x可以 ...
分类:
其他好文 时间:
2019-11-26 23:06:30
阅读次数:
124
复杂度 O(N) bool isPrime[1000001]; //isPrime[i] == 1表示:i是素数 int Prime[1000001], cnt = 0; //Prime存质数 void GetPrime(int n)//筛到n { memset(isPrime, 1, sizeof ...
分类:
其他好文 时间:
2019-11-24 11:52:07
阅读次数:
65
I had validated in .net 4.8 NewtonSoft.Json's speed rank 1st,System.Text.Json.JsonSerializer.Serialize 2nd,and BinaryFormatter 3rd. ...
分类:
Web程序 时间:
2019-11-23 19:56:26
阅读次数:
66
Calculation 2 Given a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is said ...
分类:
其他好文 时间:
2019-11-22 19:42:38
阅读次数:
65
原理:用音乐的频率改变物体的Scale 关键节点:Calculate Frequency Spectrum(计算频率),需要开启插件才能搜到 具体做法:获取音乐频率是持续不间断的,需要用到 事件Tick,用节点获取到频率变化并储存,用频率的变换改变物体的尺寸 1.先启用插件 2.添加我们要获取频率的 ...
分类:
其他好文 时间:
2019-11-21 12:04:51
阅读次数:
95
1145 Hashing - Average Search Time (25 分) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. ...
分类:
其他好文 时间:
2019-11-20 16:57:03
阅读次数:
104
例11 求质数 问题描述 质数是指除了有1和自身作为约数外,不再有其他约数的数。比如:3、5、7是质数。而9不是质数,因为它还有约数3。 编写程序求给定区间中的所有质数。 输入格式 两个整数a和b,其中1≤a≤b≤100000。 输出格式 输出给定范围的所有质数,输出时每个质数占5列,每行输出10个 ...
分类:
编程语言 时间:
2019-11-18 09:16:56
阅读次数:
91