#P11060. 【MX-X4-T0】「Jason-1」x!

【MX-X4-T0】「Jason-1」x!

Background

Original problem link: https://oier.team/problems/X4A.

Problem Description

Given a non-negative integer nn, determine whether n!n! is a multiple of n+1n+1. If it is, output YES; otherwise, output NO.

Here, n!n! denotes the factorial of nn, which is the product of all positive integers less than or equal to nn. For example, 3!=1×2×3=63! = 1 \times 2 \times 3 = 6. It is also defined that 0!=10! = 1.

Input Format

Only one line: a non-negative integer nn.

Output Format

Only one line: a string YES or NO, indicating whether n!n! is a multiple of n+1n+1.

0

YES

3

NO

6

NO

7

YES

15

YES

Hint

Sample Explanation #1

0!=10! = 1, and 11 is a multiple of 11, so output YES.

Sample Explanation #2

3!=1×2×3=63! = 1 \times 2 \times 3 = 6, and 66 is not a multiple of 44, so output NO.

Sample Explanation #3

$6! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 = 720$, and 720720 is not a multiple of 77, so output NO.

Sample Explanation #4

$7! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7= 5040$, and 50405040 is a multiple of 88, so output YES.

Sample Explanation #5

$15! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \times 8 \times 9 \times 10 \times 11 \times 12 \times 13 \times 14 \times 15 = 1{,}3076{,}7436{,}8000$, and 1,3076,7436,80001{,}3076{,}7436{,}8000 is a multiple of 1616, so output YES.

Constraints

This problem has 2020 test points. In the ii-th test point, nn is i1i-1.

For 100%100\% of the data, 0n190 \le n \le 19.

Translated by ChatGPT 5