#36087: C


yh7624908@gmail.com (黃鈺盛)

School : No School
ID : 224153
IP address : [140.119.193.7]
Last Login :
2023-02-20 00:06:19
a111. 12149 - Feynman -- UVa12149 | From: [1.163.232.208] | Post Date : 2023-07-05 12:33

#include<stdio.h>
#include<string.h>

int main(){
    int which;
    while(scanf("%d", &which) != EOF){
        if(which == 0) continue;
        int n = 0;
        for(int i = 1; i <= which; i++){
            n += i * i;
        }
        printf("%d\n", n);
    }
   
    return 0;
}
 
ZeroJudge Forum