Friday, August 9, 2019

Lightoj-1136 .cpp file

#include <bits/stdc++.h>
using namespace std;
#define calc(n) (n/3*2+(n%3==2))

int main()
{
    int a, b, cs, test;
    scanf("%d", &test);
    for(cs = 1; cs <= test; cs++)
    {
        scanf("%d %d", &a, &b);
        a--;
        printf("Case %d: %d\n", cs, calc(b) - calc(a));
    }
    return 0;
}

No comments:

Post a Comment