提出 #20151661


ソースコード 拡げる

#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;
    }
}

提出情報

提出日時
問題 A - B = C
ユーザ runnerof428
言語 C++ (GCC 9.2.1)
得点 300
コード長 333 Byte
結果 AC
実行時間 52 ms
メモリ 3636 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 11
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
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