← All problemsSign in

SUM WAYS

Your task is to count the number of ways numbers 1,2,…,n can be divided into two sets of equal sum. For example, if n=7, there are four solutions: {1,3,4,6} and {2,5,7} {1,2,5,6} and {3,4,7} {1,2,4,7} and {3,5,6} {1,6,7} and {2,3,4,5} ### Input The only input line contains an integer n. ### Output Print the answer modulo 109+7. ### Constraints - $1 \leq N \leq 500$ ### Subtasks - 30 points :

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start