Skip to content

Instantly share code, notes, and snippets.

@halka9000stg
Last active November 14, 2022 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halka9000stg/cd24e22371d34cc550c8ee707861e947 to your computer and use it in GitHub Desktop.
Save halka9000stg/cd24e22371d34cc550c8ee707861e947 to your computer and use it in GitHub Desktop.
Sibac impl
import "dart:math";
void main() {}
bool isEfficientToShorten(int len, int count, [int margin = 0]){
if(len<0||count<0||margin<0){
throw Error();
}
int repPadLen = log10(len).ceil()+log10(count).ceil()+3;
return repPadLen<len*(count-1)+margin;
}
double log10(num x)=>log(x)/log(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment