Primes

PAT_A1015 Reversible Primes

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re ......
Reversible Primes PAT_A 1015 PAT

PAT 甲级【1015 Reversible Primes】

考察素数判断 考察进制转换 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @SuppressWarnings("unc ......
甲级 Reversible Primes 1015 PAT

洛谷题解 | AT_abc321_c Primes on Interval

目录题目翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1样例 #2样例输入 #2样例输出 #2样例 #3样例输入 #3样例输出 #3题目简化题目思路AC代码 题目翻译 【题目描述】 你决定用素数定理来做一个调查. 众所周知, 素数又被称为质数,其含义就是除了数字一和本身之外不能被其 ......
题解 Interval AT_abc Primes 321

Codeforces Round 884 (Div. 1 + Div. 2) B. Permutations & Primes

给一个正整数 \(n\) ,你需要构造一个 \(n\) 的排列 \(p_1, p_2, \cdots, p_n\) 。对于排列 \(p\) 的每个子段 \([l, r]\) ,\(mex_{i = l}^{r} a_i\) 的结果为质数的次数尽可能多。 此处的 \(mex\) 最小排除值最低为 \( ......
Permutations Codeforces Div Primes Round

洛谷题解 | AT_abc321_c Primes on Interval

目录题目翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1样例 #2样例输入 #2样例输出 #2样例 #3样例输入 #3样例输出 #3题目简化题目思路AC代码 题目翻译 【题目描述】 你决定用素数定理来做一个调查. 众所周知, 素数又被称为质数,其含义就是除了数字一和本身之外不能被其 ......
题解 Interval AT_abc Primes 321

SP13015 CNTPRIME -Counting Primes

##[$CNTPRIME$ - $Counting$ $Primes$](https://www.spoj.com/problems/CNTPRIME/) ### 题目描述 给定初始序列 $A$,然后对原序列有以下操作: - 操作 $1$:`0 l r v` 将区间$[l,r]$ 全赋值为$v$。 ......
CNTPRIME Counting Primes 13015 SP

Primes on Interval 题解

[题目传送门](https://www.luogu.com.cn/problem/CF237C) 一道二分题。 我们需要用二分在 $O(n\log n)$ 的时间复杂度内得到答案,也就是说我们的判断函数时间复杂度必须为 $O(n)$,因此考虑前缀和。 $sum_i$ 表示出现在区间 $\left[a ......
题解 Interval Primes on

Codeforces Round 884 (Div. 1 + Div. 2) B. Permutations & Primes

题目大意求出一个n的排列,使得对于所有的长度的子区间其中不包含在该子区间中最小正整数为质数,这样的区间数最多 对于任意长度的区间,如果1不包含,则这样的区间一定是bad的,因此我们想要1尽可能在区间中则1放中间,此外,2和3是除1外的最小正整数也是质数,如果2和3不包含在区间则该区间一定是good的 ......
Permutations Codeforces Div Primes Round

Primes on Interval(欧拉筛+二分+滑动窗口)

【题面】 你决定用素数定理来做一个调查. 众所周知, 素数又被称为质数,其含义就是除了数字一和本身之外不能被其他任何的数字除尽. 现在给定一个正整数序列 ,+1,⋯ ,a,a+1,⋯,b (≤)(a≤b), 请找出一个最小值 l, 使其满足对于任意一个长度为 l 的子串, 都包含 k 个质数. 找到 ......
Interval Primes on

PAT 甲级 1015 Reversible Primes(20)

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re ......
甲级 Reversible Primes 1015 PAT

Sum of Different Primes UVA - 1213

选择K个质数,使它们的和等于N。问有多少种方案? 例如,n=24, k=2时有3种方案:5+19=7+17=11+13=24 #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using name ......
Different Primes 1213 Sum UVA
共11篇  :1/1页 首页上一页1下一页尾页