projecteulerproblem6

problem6

地址:https://projecteuler.net/problem=6。
源码:git@code.aliyun.com:c-program/projecteuler.git。
问题:找到100和平方与平方和的差值。

#include <stdio.h>
#include <math.h>
#include "debug.h"

#define NUM 100

int main(int argc, char **argv){
    long int iResult = 0;
    int i, j;

    debugTime();

    for (i = 1; i < NUM; i++){
        for (j = i + 1; j <= NUM; j++){
            iResult += i * j;
        }
    }

    iResult *= 2;
    
    printf("Problem6  Answer: %ld\n", iResult);

    debugTime();

    return 0;
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理