Submission #20154918


Source Code Expand

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

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

Submission Info

Submission Time
Task A - B = C
User nikIITP18
Language C++ (GCC 9.2.1)
Score 300
Code Size 271 Byte
Status AC
Exec Time 53 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 53 ms 3396 KiB
00maxB.txt AC 49 ms 3632 KiB
prefix.txt AC 48 ms 3564 KiB
random.txt AC 48 ms 3520 KiB
random_2.txt AC 49 ms 3636 KiB
random_3.txt AC 50 ms 3436 KiB
random_4.txt AC 50 ms 3404 KiB
sample.txt AC 3 ms 3404 KiB
small.txt AC 46 ms 3392 KiB
small_2.txt AC 3 ms 3564 KiB
suffix.txt AC 52 ms 3564 KiB