|
|
|
@ -33,9 +33,8 @@ int GetSmallestAboveThreshold(File&f,std::string path,int remaining,int*smallest |
|
|
|
|
int sum=0; |
|
|
|
|
for (std::map<std::string,File>::iterator it=f.files.begin();it!=f.files.end();it++){ |
|
|
|
|
int amt=GetSmallestAboveThreshold(it->second,(path=="/")?path+it->first:path+"/"+it->first,remaining,smallest); |
|
|
|
|
|
|
|
|
|
if (amt>=remaining){ |
|
|
|
|
std::cout<<"Remaining: "<<remaining<<" My Sum:"<<amt<<std::endl; |
|
|
|
|
std::cout<<"Remaining: "<<remaining<<" My Sum:"<<amt<<" Current Smallest:"<<*smallest<<std::endl; |
|
|
|
|
if (amt<*smallest&&path!="/"){ |
|
|
|
|
*smallest=amt; |
|
|
|
|
} |
|
|
|
@ -171,7 +170,7 @@ int main() |
|
|
|
|
int remaining=30000000-(diskSpace-totalSpace); |
|
|
|
|
int smallest=diskSpace; |
|
|
|
|
int deleteSize=GetSmallestAboveThreshold(rootFile,"/",remaining,&smallest); |
|
|
|
|
std::cout<<"Smallest to delete: "<<deleteSize<<std::endl; |
|
|
|
|
std::cout<<"Smallest to delete: "<<smallest<<std::endl; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|