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:一次 AC ,0MS……滚滚长江…………

Posted by miklcct at 2012-07-26 14:53:03 on Problem 2000
In Reply To:一次 AC ,0MS……滚滚长江………… Posted by:songzhenqi at 2010-07-28 11:30:02
#include <stdio.h>

int main(void) {
    int data[50000];
    data[0] = 0;
    int *p = data + 1;
    for (int i = 1; p < data + 10001; ++i) {
        for (int j = 0; j < i; ++j) {
            *p = p[-1] + i;
            ++p;
        }
    }
    int x;
    while (scanf("%d", &x) , x) {
        printf("%d %d\n", x, data[x]);
    }
}

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