测试用例:
3
1 2 3
2 3 4
2147483647 0 2147483646
对应输出应该为:
Case #1: false
Case #2: true
Case #3: true
#include <iostream>
using namespace std;
bool compare(long a[3]);
bool compare(long a[3]){
float m=a[0]+a[1];
if(m>a[2]){
return true;
}else{
return false;
}
}
int main(){
int t;
cin>>t;
long a[t][3];
for(int i=0;i<t;i++){
for(int k=0;k<3;k++){
cin>>a[i][k];
}
}
for(int i=0;i<t;i++){
long b[2]={};
for(int k=0;k<3;k++){
b[k]=a[i][k];
}
if(compare(b)==0){
cout<<"Case #"<<i+1<<":"<<"false"<<endl;
}else{
cout<<"Case #"<<i+1<<":"<<"true"<<endl;
}
}
}
https://www.nowcoder.com/pat/6/problem/4077