JGTLE - Jalil Got TLE

题意翻译

题目描述: 提交一个代码,使得与题目中给定的代码输出相同,但是更快,能够避免TLE。 输入格式: 第一行输入一个数T,测试数据的组数。 对于每一组测试数据,输入三个数a,b,c,均为正数。 输出格式: 对于每一组测试数据,输出与给定程序相同的输出。 感谢@nstk0513 提供的翻译

题目描述

Ananta Jalil is a multi talented person. He can make any task possible which is impossible to others. Recently he has learned programming basic. In a problem, he submitted the following solution: ``` #include <stdio.h> int main() { int t; scanf("%d", &t); for(int tc = 1; tc <= t; ++tc) { int a, b, c; scanf("%d %d %d", &a, &b, &c); long long result = 0; for(int i = 1; i <= a; ++i) { for(int j = 1; j <= b; ++j) { for(int k = 1; k <= c; ++k) { result += j * k; } } } printf("Case %d: %lld\n", tc, result); } return 0; } ``` But he got TLE (Time Limit Exceeded) as he is novice in programming. That’s why his solution was not efficient. So you are here to write an optimized solution for Jalil which will give the same output.

输入输出格式

输入格式


The first line of input will contain a positive integer T denoting the number of test cases. In each test case, there will be 3 positive integers a, b and c.

输出格式


For each test case, print the output as same as the above program.

输入输出样例

输入样例 #1

3
1 4 3
3 4 2
143 342 777

输出样例 #1

Case 1: 60
Case 2: 90
Case 3: 2535110464887