close

https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=4797

 

#include <stdio.h>
#include <stdlib.h>
int main() {
    int n;
    scanf("%d", &n);
    while (n--) {
        long long int a, b;
        scanf("%lld %lld", &a, &b);
        long long int ans;
        ans = (b + b - a - 1) * a / 2 ;
        printf("%lld\n",ans);
    }
    return 0;
}

arrow
arrow
    文章標籤
    UVA12918 Lucky Thief
    全站熱搜

    楓綺 發表在 痞客邦 留言(0) 人氣()