fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4.  
  5. int main() {
  6. double a,b,c,temp;
  7. cin >> a >> b >> c;
  8. if(a < b+c && b < c+a && c < a+b){
  9. cout << "Valid\n";
  10. double s = (a+b+c)/2.0;
  11. cout << fixed << sqrt(s*(s-a)*(s-b)*(s-c));
  12. }else{
  13. cout << "Invalid";
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 5228KB
stdin
3 4 1
stdout
Invalid