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 zorulee at 2016-06-01 21:16:09 on Problem 2000
In Reply To:据说一次过的都要放代码 Posted by:NaN3 at 2013-06-22 14:49:44
#include<stdio.h>
int main()
{
    int n,i,k,t,ans;
    while(scanf("%d",&n),n)
    {
        k=1;
        ans=0;
        for(i=0;i<n;)
        {
            for(t=0;t<k && i<n;t++,i++)
                ans+=k;
            k++;
        }
        printf("%d %d\n",n,ans);
    }
    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