305779: CF1089F. Fractions
Memory Limit:512 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Fractions
题意翻译
## 题目描述 给定一个$n$,确定一些分数,使得这些分数的分母是$n$的因数,且$<n$,并且这些分数都是真分数,这些分数的和+$\frac{1}{n}=1$。 ## 输入格式 只有一行,是一个正整数$n$ ## 输出格式 如果无解输出一行"NO"(没有引号) 如果有解,先输出"YES"(没有引号),然后输出一个$k$,表示有多少个分数。接下来$k$行,每行两个数,是一个经过化简的分数,第一个是分子,第二个是分母。注意您输出的$k$要$<=10^5$,因为数据保证一定在$10^5$长度内有解。如果您输出的$k$超过了$10^5$,就会被判错(具体是$OLE$还是$WA$不知道,反正都是错了)。题目描述
You are given a positive integer $ n $ . Find a sequence of fractions $ \frac{a_i}{b_i} $ , $ i = 1 \ldots k $ (where $ a_i $ and $ b_i $ are positive integers) for some $ k $ such that: $ $ \begin{cases} \text{$b_i$ divides $n$, $1 < b_i < n$ for $i = 1 \ldots k$} \\ \text{$1 \le a_i < b_i$ for $i = 1 \ldots k$} \\ \text{$\sum\limits_{i=1}^k \frac{a_i}{b_i} = 1 - \frac{1}{n}$} \end{cases} $ $输入输出格式
输入格式
The input consists of a single integer $ n $ ( $ 2 \le n \le 10^9 $ ).
输出格式
In the first line print "YES" if there exists such a sequence of fractions or "NO" otherwise. If there exists such a sequence, next lines should contain a description of the sequence in the following format. The second line should contain integer $ k $ ( $ 1 \le k \le 100\,000 $ ) — the number of elements in the sequence. It is guaranteed that if such a sequence exists, then there exists a sequence of length at most $ 100\,000 $ . Next $ k $ lines should contain fractions of the sequence with two integers $ a_i $ and $ b_i $ on each line.
输入输出样例
输入样例 #1
2
输出样例 #1
NO
输入样例 #2
6
输出样例 #2
YES
2
1 2
1 3