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 NaN3 at 2013-06-22 14:49:44 on Problem 2000
#include<iostream>
#include<cstring>

using namespace std;

int main(){
    int dd; cin>>dd;
    while(dd!=0){
        int I = 1, D = 0, S = 0;
        while(D + I <= dd){
            S += I*I;
            D += I;
            I ++;
        }
        S += (dd - D) * (I);
        cout<<dd<<' '<<S<<endl;
        cin>>dd;
    }
    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