generated from sigonasr2/CPlusPlusProjectTemplate
WHOO!
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
dd63de88e4
commit
b5e2f7183e
Binary file not shown.
5
main.cpp
5
main.cpp
@ -33,9 +33,8 @@ int GetSmallestAboveThreshold(File&f,std::string path,int remaining,int*smallest
|
|||||||
int sum=0;
|
int sum=0;
|
||||||
for (std::map<std::string,File>::iterator it=f.files.begin();it!=f.files.end();it++){
|
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);
|
int amt=GetSmallestAboveThreshold(it->second,(path=="/")?path+it->first:path+"/"+it->first,remaining,smallest);
|
||||||
|
|
||||||
if (amt>=remaining){
|
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!="/"){
|
if (amt<*smallest&&path!="/"){
|
||||||
*smallest=amt;
|
*smallest=amt;
|
||||||
}
|
}
|
||||||
@ -171,7 +170,7 @@ int main()
|
|||||||
int remaining=30000000-(diskSpace-totalSpace);
|
int remaining=30000000-(diskSpace-totalSpace);
|
||||||
int smallest=diskSpace;
|
int smallest=diskSpace;
|
||||||
int deleteSize=GetSmallestAboveThreshold(rootFile,"/",remaining,&smallest);
|
int deleteSize=GetSmallestAboveThreshold(rootFile,"/",remaining,&smallest);
|
||||||
std::cout<<"Smallest to delete: "<<deleteSize<<std::endl;
|
std::cout<<"Smallest to delete: "<<smallest<<std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user