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

求助一道题。菜鸟我

Posted by chibisam at 2007-06-04 00:30:50
我就会用穷举法。。然后n=1000显然超时了呀。。。

There Numbers
Submit: 10   Accepted:1
Time Limit: 1000MS  Memory Limit: 65536K
Description
Given a positive integer n.Choose 3 distinguishing numbers a1,a2,a3 from 1 to n(1<=a1,a2,a3<=n),find the number of ways that satisfying the equation (a1+a2+a3)%3=0.

Input
A positive integer n(0 < n < 1000).


Output
The number of ways that satisfying the equation.


Sample Input

3


Sample Output

1


Source

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