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 lijiwu at 2004-12-22 14:09:26 on Problem 2000
#include<stdio.h>
void main(){
    int i,m,n,a,t,j;
    scanf("%d\n",&n);
    while(n!=1){
        for(i=1;i<=n;i++){
            m=n-i;
            if(m<=i+1){
                j=i;
                break;
            }
        }
        for(t=1;t<=j;t++) 
            a+=t*t;
        a=a+m*(j+1);
        printf("%d %d\n",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