Note: This article is available in Chinese only. 本文暂无英文版本。
View original
zoj 3622 Magic Number (构造?)
Related
poj 1305 (毕达哥拉斯三元组,构造勾股数)
题意是说,能构造多少本元勾股数和勾股数,要求构造的数<=n
所谓本元勾股数,就是三个勾股数没有公因数,两两互质。
由本元勾股数扩大k倍,就可以得到其他勾股数。
而构造本元勾股数的方法如下:
codeforces 534 A. Exam
A. Exam
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side by side and became friends and if they take an exam sitting next to each other, they will help each other for sure.
codeforces 482 A. Diverse Permutation(构造)
C - C
**Time Limit:**1000MS **Memory Limit:**262144KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
Permutation_p_ is an ordered set of integers _p_1, p_2, …, p__n, consisting of n distinct positive integers not larger than n. We’ll denote as_n the length of permutation _p_1, _p_2, …, p__n.
Your task is to find such permutation p of length n, that the group of numbers |_p_1 - _p_2|, |_p_2 - _p_3|, …, |p__n - 1 - p__n| has exactly k distinct elements.
Input
The single line of the input contains two space-separated positive integers n, k (1 ≤ k < n ≤ 105).