Skip to main content
Post Undeleted by 640KB
deleted 1126 characters in body
Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 89 84 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>1,3,7.77][$a];echo$argv[1]/100+($b?:.1)|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8

$ php lucky.php 0 2522
3

$ php lucky.php 0 abaa
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!

PHP, 89 84 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>1,3,7.77][$a];echo$argv[1]/100+($b?:.1)|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8

$ php lucky.php 0 2522
3

$ php lucky.php 0 abaa
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!

PHP, 89 84 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>1,3,7.77][$a];echo$argv[1]/100+($b?:.1)|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8

$ php lucky.php 0 2522
3

$ php lucky.php 0 abaa
3
Post Deleted by 640KB
-5 bytes, reduce scores to floats
Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 8989 84 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>100$b+=[2=>1,3003,777][$a];echo(7.77][$a];echo$argv[1]/100+($b?:10)+$argv[1].1)/100|0;|0;

Try it online!Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8 

$ php lucky.php 0 2522
3

$ php lucky.php 0 abaa
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!

PHP, 89 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>100,300,777][$a];echo(($b?:10)+$argv[1])/100|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8
$ php lucky.php 0 2522
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!

PHP, 89 84 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>1,3,7.77][$a];echo$argv[1]/100+($b?:.1)|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8 

$ php lucky.php 0 2522
3

$ php lucky.php 0 abaa
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!

Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 89 bytes

foreach(count_chars($argv[2])as$a)$b+=[2=>100,300,777][$a];echo(($b?:10)+$argv[1])/100|0;

Try it online!

Input from command line, output to STDOUT:

$ php lucky.php 99 3333
8
$ php lucky.php 0 2522
3

Or using the same method as the ASM answer above:

PHP, 103 bytes

for([,$c,$s]=$argv;$i<4;$l+=$r)if(2<$r=substr_count($s,$s[$i],++$i)){$l++;$c+=77;}echo$l+=$c+10*!$l>99;

Try it online!