Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
305 B
2
Indexable
#include <iostream>
using namespace std;

int main() {
    unsigned long long i, j;
    cin >> i >> j;

    unsigned long long sum_j = j * (j + 1) / 2;
    unsigned long long sum_i_minus_1 = (i - 1) * i / 2;
    
    unsigned long long result = sum_j - sum_i_minus_1;

    cout << result;
    return 0;
}
Leave a Comment