fork(4) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. long int ile, liczba;
  11. vector<double> trojkat(3);
  12. double kg, c, p;
  13. long double wynik=0;
  14. cin>>ile;
  15. for(int i=0; i<ile; i++)
  16. {
  17. wynik=0;
  18. cin>>liczba>>kg;
  19. for(int j=0; j<liczba; j++)
  20. {
  21. cin>>trojkat[0]>>trojkat[1]>>trojkat[2];
  22. sort(trojkat.begin(),trojkat.end());
  23. if(trojkat[0]+trojkat[1]>trojkat[2])
  24. {
  25. c=(trojkat[0]+trojkat[1]+trojkat[2])/2;
  26. p=sqrt(c*(c-trojkat[0])*(c-trojkat[1])*(c-trojkat[2]));
  27. wynik+=p;
  28. }
  29. }
  30. wynik = (wynik*kg/10);
  31. if(round(wynik==0)) cout<<"0"<<endl;
  32. else
  33. {
  34. cout<<round(wynik)<<endl;
  35. }
  36. }
  37. return 0;
  38. }
Time limit exceeded #stdin #stdout 5s 4228KB
stdin
Standard input is empty
stdout
Standard output is empty