冲刺练习2020-10-21
A : Compass-and-straightedge construction
Description
input an integer n n n 。
Out put whether you can draw an regular n-polygon by compass-and-straightedge construction.
Compass-and-straightedge construction means you can only use a ruler which have no degree scale and a compass , and a pen of course.
Many cases to be input.
Constraints
3 ≤ n ≤ 1 × 1 0 18 3\le n\le 1\times10^{18} 3≤n≤1×1018
Sum Cases < 1 0 5 10^5 105
Sample In
3 4 5 6 7 8 9 10 65537
Sample Out
Y Y Y Y N Y N Y Y
Solution
(结论裸题)
B : Prime Pairs
Description
output every pair form of p^a-q^b=1
where p and q are primes, and a and b are positive integers , and a,b > 1
Constraints
In order to avoid huge output, there must have :
1 < a , b < 1 0 5 1<a,b<10^5 1<a,b<105
2 ≤ p , q ≤ 1 0 5 2\le p,q\le 10^5 2≤p,q≤105
Sample In
None
Sample Out
None
Solution
《初等数论及其应用》P66 , 23题
(签到题)
C : Easy Prime Number Partitions
Description
input an integer n.
Determine whether it could be written in the sum of different primes.
Many cases to be input.
Constraints
2 ≤ n ≤ 1 0 9 2\le n\le 10^9 2≤n≤109
Sum Cases < 1 0 5 10^5 105
Sample In
2 4 100 114514
Sample Out
Y N Y Y
Solution
《初等数论及其应用》P67 , 28题
(签到题)
D : Easy Composite Number Partitions
Description
input an integer n.
Determine whether it could be written in the sum of two composite numbers.
Many cases to be input.
Constraints
2 ≤ n ≤ 1 0 9 2\le n\le 10^9 2≤n≤109
Sum Cases < 1 0 5 10^5 105
Sample In
2 4 100 114514
Sample Out
N N Y Y
Solution
《初等数论及其应用》P66 , 14题
(签到题)
E : Minimum Positive Linear Combination
Description
each line gives you two positive integer a , b a,b a,b
output the minimum positive k k k ,s.t.
k = m a + n b k=ma+nb k=ma+nb , where m , n m,n m,n is an integer
Constraints
1 ≤ a , b ≤ 1 0 9 1\le a,b\le 10^9 1≤a,b≤109
Sum Cases < 1 0 3 10^3 103
Sample In
1 100
9 15
Sample Out
1
3
Solution
《初等数论及其应用》P69 , 定理3.7
(签到题)
F : Half-coprime Array
Description
give you an integer n n n
you need to output an array , which length is n.
and gcd ( a 1 , a 2 , ⋯ , a n ) = 1 \gcd(a_1,a_2,\cdots,a_n)=1 gcd(a1,a2,⋯,an)=1
However , if you select n − 1 n-1 n−1 elements s.t. b 1 , b 2 , ⋯ , b n − 1 b_1,b_2,\cdots,b_{n-1} b1,b2,⋯,bn−1 ∀ i ≠ j , b i ≠ b j \forall i\ne j,\,b_i\ne b_j ∀i=j,bi=bj and ∀ i , b i ∈ { a 1 , a 2 , ⋯ , a n } \forall i,\,b_i\in\{a_1,a_2,\cdots,a_n\} ∀i,bi∈{a1,a2,⋯,an}
and gcd ( b 1 , b 2 , ⋯ , b n − 1 ) ≠ 1 \gcd(b_1,b_2,\cdots,b_{n-1}) \ne 1 gcd(b1,b2,⋯,bn−1)=1
Constraints
3 ≤ n ≤ 15 3\le n\le 15 3≤n≤15
1 ≤ a i ≤ 1 0 18 1\le a_i\le 10^{18} 1≤ai≤1018
Sample In
4
Sample Out
910 570 714 1155
Solution
《初等数论及其应用》P73 , 练习18
(魔改+数据增强)