Submission #20145170


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main(){
	long long int n;
	cin >> n;
	for(long long int i = 0;i<n;i++){
		long long int a,b;
		cin >> a >> b;
		long long int c;
		if(b<2*a){
			cout << 0 << endl;
		}
		else{
		c = b-2*a+1;
		long long int d;
		 d = (c+1)*c/2;
		cout << d << endl;
	}
}
	return 0;
}

Submission Info

Submission Time
Task A - B = C
User hocashi
Language C++ (GCC 9.2.1)
Score 300
Code Size 338 Byte
Status AC
Exec Time 53 ms
Memory 3620 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 53 ms 3552 KiB
00maxB.txt AC 48 ms 3448 KiB
prefix.txt AC 48 ms 3440 KiB
random.txt AC 49 ms 3620 KiB
random_2.txt AC 51 ms 3552 KiB
random_3.txt AC 51 ms 3440 KiB
random_4.txt AC 50 ms 3592 KiB
sample.txt AC 6 ms 3452 KiB
small.txt AC 46 ms 3392 KiB
small_2.txt AC 2 ms 3564 KiB
suffix.txt AC 46 ms 3408 KiB