Created with <3 with dartpad.dev.
Last active
November 14, 2022 21:09
-
-
Save halka9000stg/cd24e22371d34cc550c8ee707861e947 to your computer and use it in GitHub Desktop.
Sibac impl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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