Atcoder ABC 139D

Atcoder ABC 139D

解法:

等差数列求和公式,记得开 $ long long $

CODE:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define LL long long

LL n,ans;

int main() {
    scanf("%lld",&n);
    ans = n * (n - 1) / 2;
    printf("%lld \n",ans);
    //system("pause");
    return 0;
}
posted @ 2019-09-02 21:15  西窗夜雨  阅读(139)  评论(0编辑  收藏  举报