Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #define INF 1e8
- using namespace std;
- long long x[100];
- long long y[100];
- long long z[100];
- long long d;
- int f(int k,int vol){
- int o;
- if(k == 0 && vol == 0){
- return 0;
- }
- else if(k == 0){
- return INF;
- }
- else if(k <= vol){
- return min(d ,abs(d) + f(k-1,vol -((x[k] + d) * (y[k] + d) * (z[k] + d))));;
- }
- else{
- return INF;
- }
- }
- int main() {
- long long a,vol;
- cin>>a>>vol;
- long long d1;
- long long counter=0;
- for(int k1=0;k1<a;k1++){
- cin>>x[k1];
- cin>>y[k1];
- cin>>z[k1];
- d1= min(x[k1],y[k1]);
- d1= min(d1,z[k1]);
- for(int j=0;j<d1;j++){
- if(f(d,vol) == vol){
- counter+=d;
- }
- }
- }
- cout<<counter;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement