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:hehe

Posted by LIBAI at 2004-12-22 16:28:28 on Problem 2000
In Reply To:麻烦给我看一下,谢谢 Posted by:lijiwu at 2004-12-22 14:09:26
#include<stdio.h>
void main(){
    int i,n,t;
    scanf("%d\n",&n);
    while(n!=0){
		int a=0;
		printf("%d ",n);
        for(i=1;i<=n;i++){
            n=n-i;
            if(n<=i+1)break;
        }
        for(t=1;t<=i;t++) 
            a+=t*t;
        a=a+n*(i+1);
        printf("%d\n",a);
        scanf("%d\n",&n);
    }
}    }    

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