Title:
given interval [-2 31 th, 31 th 2] 3 integers A, B and C in, please determines whether A + B is greater than C.
Input format:
Enter line 1 gives a positive integer T (≤10), are the number of test cases. T is then given set of test cases, each per line, the order is given A, B and C. Between integer separated by a space.
Output format:
for each test case, the output in line Case #X: true if A + B> C, otherwise the output Case #X: false, where X is the test case number (starting from 1).
Sample input:
4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647
Sample output:
Case #1: false
Case #2: true
Case #3: true
Case #4: false
My code:
#include<iostream>
using namespace std;
int main()
{
int num;
cin>>num;
for(int i=0;i<num;i++)
{
double a,b,c;
cin>>a>>b>>c;
if(a/2+b/2>c/2)
cout<<"Case #"<<i+1<<": true"<<endl;
else
cout<<"Case #"<<i+1<<": false"<<endl;
}
}