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

Re:平方和公式犀利

Posted by ziqiangyeah at 2013-08-02 17:03:59 on Problem 2000
In Reply To:平方和公式犀利 Posted by:hustcswgy at 2011-07-27 17:59:27
> #include<stdio.h>
> 
> int main()
> {
>     int day;
>     while(scanf("%d", &day), day)
>     {
>         int n = 1;
>         while((1+n)*n/2 < day) n++;
>         printf("%d %ld\n", day, (n-1)*n*(2*n-1)/6 + n*(day-(n-1)*n/2));
>     }
>     return 0;
> }

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