Advertisement
theo830

δςυ

Jun 1st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #define INF 1e8
  4. using namespace std;
  5. long long x[100];
  6. long long y[100];
  7. long long z[100];
  8. long long d;
  9. int f(int k,int vol){
  10. int o;
  11. if(k == 0 && vol == 0){
  12. return 0;
  13. }
  14. else if(k == 0){
  15. return INF;
  16. }
  17. else if(k <= vol){
  18. return min(d ,abs(d) + f(k-1,vol -((x[k] + d) * (y[k] + d) * (z[k] + d))));;
  19. }
  20. else{
  21. return INF;
  22. }
  23. }
  24. int main() {
  25. long long a,vol;
  26. cin>>a>>vol;
  27. long long d1;
  28. long long counter=0;
  29. for(int k1=0;k1<a;k1++){
  30. cin>>x[k1];
  31. cin>>y[k1];
  32. cin>>z[k1];
  33. d1= min(x[k1],y[k1]);
  34. d1= min(d1,z[k1]);
  35. for(int j=0;j<d1;j++){
  36. if(f(d,vol) == vol){
  37. counter+=d;
  38. }
  39. }
  40. }
  41. cout<<counter;
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement