Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent dd63de88e4
commit b5e2f7183e
  1. BIN
      C++ProjectTemplate
  2. 5
      main.cpp

Binary file not shown.

@ -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;
}

Loading…
Cancel
Save