Submission #20151661


Source Code Expand

#include <iostream>
using namespace std;

long long sum(long long x){
    return ((x+1)*x)/2;
}

int main(){
    long long N,i,L,R,j;
    cin >> N;
    for(i=0;i<N;i++){
        cin >> L >> R;
        j=2*L;
        if(j<=R){
            cout << sum(R-j+1) << endl;
        }
        else cout << 0 << endl;
    }
}

Submission Info

Submission Time
Task A - B = C
User runnerof428
Language C++ (GCC 9.2.1)
Score 300
Code Size 333 Byte
Status AC
Exec Time 52 ms
Memory 3636 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 11
Set Name Test Cases
Sample sample.txt
All 00maxA.txt, 00maxB.txt, prefix.txt, random.txt, random_2.txt, random_3.txt, random_4.txt, sample.txt, small.txt, small_2.txt, suffix.txt
Case Name Status Exec Time Memory
00maxA.txt AC 52 ms 3408 KiB
00maxB.txt AC 48 ms 3620 KiB
prefix.txt AC 49 ms 3436 KiB
random.txt AC 49 ms 3584 KiB
random_2.txt AC 49 ms 3636 KiB
random_3.txt AC 49 ms 3524 KiB
random_4.txt AC 51 ms 3588 KiB
sample.txt AC 2 ms 3568 KiB
small.txt AC 47 ms 3440 KiB
small_2.txt AC 2 ms 3404 KiB
suffix.txt AC 50 ms 3524 KiB