码迷,mamicode.com
首页 >  
搜索关键字:bear and prime numbe    ( 2904个结果
判断质数与筛质数
一:判定质数 要判断一个数是不是质数,只需遍历小于等于它的所有数,如果它能被除了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
Codeforces Round #601 (Div. 2) E1 Send Boxes to Alice (Easy Version)
#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)【简单数论】【质因数分解】【算术基本定理】(未完成)
Pairs Forming LCM (LightOJ 1236)【简单数论】【质因数分解】【算术基本定理】(未完成) 标签: 入门讲座题解 数论 题目描述 Find the result of the following code: ...
分类:其他好文   时间:2019-11-27 12:21:00    阅读次数:76
CodeForces - 1228C(质因数分解+贡献法)
题意 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
PAT 甲级 1145 Hashing - Average Search Time (25 分)(读不懂题,也没听说过平方探测法解决哈希冲突。。。感觉题目也有点问题)
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
elementui表单验证小于300的正整数
alarm_time: [ { required: true, message: "请输入时间", trigger: "blur" }, { validator(rule, value, callback) { if (Number.isInteger(Number(value)) && Numbe ...
分类:其他好文   时间:2019-11-18 18:23:47    阅读次数:116
C语言程序设计100例之(11):求质数
例11 求质数 问题描述 质数是指除了有1和自身作为约数外,不再有其他约数的数。比如:3、5、7是质数。而9不是质数,因为它还有约数3。 编写程序求给定区间中的所有质数。 输入格式 两个整数a和b,其中1≤a≤b≤100000。 输出格式 输出给定范围的所有质数,输出时每个质数占5列,每行输出10个 ...
分类:编程语言   时间:2019-11-18 09:16:56    阅读次数:91
实验3
恢复内容 #include<stdio.h> int main() { long int s,p=1,t=0; printf("输入一个整数:"); scanf("%ld",&s); while(s) { if((s%10)%2==1) { t=t+(s%10)*p; p=p*10; } s=s/1 ...
分类:其他好文   时间:2019-11-17 17:32:56    阅读次数:67
cf B. Bear and Compressing
B. Bear and Compressing 思路:字符串是什么样的有多种情况不定,但我们总是知道最后一个肯定是a,那么我们就可以反着推,看a是由那个序列变过来的,拿案例一的数据说,比如我们先看见ca,可以变成a,那a的上一个状态就是ca,由“ca”代替“a“,此时长度为2,还不够长,所以继续找, ...
分类:其他好文   时间:2019-11-17 13:13:25    阅读次数:68
2904条   上一页 1 ... 18 19 20 21 22 ... 291 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!