FRACTION - Số chữ số thập phân

View as PDF

Submit solution

Points: 1.00 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C#, C++, Go, Java, Pascal, Perl, PHP, Python, Ruby, Rust, Scratch, Swift

Phân số ~\frac{1}{8} = 0,125~ có ~3~ chữ số thập phân sau dấu phẩy thập phân.Phân số ~\frac{1}{7} = 0,142857142857142857 \cdots ~ có vô hạn số thập phân sau dấu phẩy thập phân.

Yêu cầu: Cho ~n\ (1≤n≤10^9)~. Hãy đếm số lượng số chữ số sau dấy phẩy thập phân của phân số ~\frac{1}{n}~.

Input

  • Số nguyên dương ~n~.

Output

  • Số lượng số chữ số sau dấy phẩy thập phân của phân số ~\frac{1}{n}~. Nếu có vô hạn số thì ghi NO.

Sample

Input #1
8
Output #1
3
Input #2
7
Output #2
NO

Problem source: Chuyên Sơn La Online Judge


Comments

Please read the guidelines before commenting.


There are no comments at the moment.