#54439: C++解法


william000000000 (unknown)


#include <iostream>

using namespace std;

int main()
{
    int t, s, f, total = 0;
    cin >> t;

    for (int i = 1; i <= t; i++) {
        cin >> s >> f;

        if (s % 2 == 0) {
            s += 1; // even to odd
        }

        for (int j = s; j <= f; j += 2) {
            total += j;
        }

        cout << "Case " << i << ": " << total << endl;
        total = 0;
    }
    return 0;
}