Given three integers A, B and C in [−263,263], you are supposed to tell whether A+B>C.
Input Specification:
The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.
Output Specification:
For each test case, output in one line Case #X: true if A+B>C, or Case #X: false otherwise, where X is the case number (starting from 1).
public static void Main() { int T = int.Parse(Console.ReadLine()); for (int i = 0; i < T; i++) { decimal A, B, C; string[] tokens = System.Console.ReadLine().Split(); A = decimal.Parse(tokens[0]); B = decimal.Parse(tokens[1]); C = decimal.Parse(tokens[2]); if (A + B > C ? true : false) { Console.WriteLine("Case #{0}: true", i + 1); } else { Console.WriteLine("Case #{0}: false", i + 1); } } }
public static void Main() { int T = int.Parse(Console.ReadLine()); for (int i = 0; i < T; i++) { long A, B, C; string[] tokens = System.Console.ReadLine().Split(); A = long.Parse(tokens[0]); B = long.Parse(tokens[1]); C = long.Parse(tokens[2]); long sum = A + B; if (A > 0 && B > 0 && sum < 0) { Console.WriteLine("Case #{0}: true", i + 1); } else { if (A < 0 && B < 0 && sum >= 0) { Console.WriteLine("Case #{0}: false", i + 1); } else { if (sum > C) { Console.WriteLine("Case #{0}: true", i + 1); } else { Console.WriteLine("Case #{0}: false", i + 1); } } } } }