Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

shu problem A

Posted by lin_ at 2006-10-21 13:12:42
Balls

Time Limit : 1 seconds Memory Limit : 10MB

Tracy has been dreaming of becoming a basketball player for many years. But considering her current height... However, Tracy still loves basketball. One day she saw a basketball game: There were n big baskets with unlimited height but small width which only allows one ball to pass.

A player can shoot a basketball into arbitrary baskets. Basketballs are numbered from 1. The player should obey the following rules:

1. Balls with smaller numbers should be put under balls with larger numbers.
2. The sum of two neighboring balls' number should be a prime.
3. You can't shoot the basketball numbered i unless the basketball numbered i - 1 has already been successfully shot into one of the baskets.

The winner is the person who shoots most number of basketballs.
All the balls numbered from 1 to n should be shot into baskets.
Tracy wanted to win the game. She wanted to know how many balls can be put at most?

Input:

The input file contains several test cases. For each test case:
only one line contains one number n (0<= n < 16).

Output:

For each test case, output one number m, the maximal number of balls, on a separate line.

Sample Input:

1

Sample Output:

4


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator