Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 46 characters in body
Source Link
Kjetil S
  • 6.2k
  • 11
  • 23

Perl 5 -app, 52(削除) 52 (削除ここまで) 47 bytes

Saved 5 bytes thanks to @Dom Hastings.

$_=332312332132330x$F[1];/ /;$_=332312332132330x$';/(.*?$F[0]$`){$F[1]$'}/g;$_=pos

Try it online! Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first of the two inputs. Finds the position of the n'th occurrence of what's wanted with a regexp search in a repeated 15 char string encoding number, fizz, buzz and fizzbuzz in their right places.

Perl 5 -ap, 52 bytes

$_=332312332132330x$F[1];/(.*?$F[0]){$F[1]}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first of the two inputs. Finds the position of the n'th occurrence of what's wanted with a regexp search in a repeated 15 char string encoding number, fizz, buzz and fizzbuzz in their right places.

Perl 5 -p, (削除) 52 (削除ここまで) 47 bytes

Saved 5 bytes thanks to @Dom Hastings.

/ /;$_=332312332132330x$';/(.*?$`){$'}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first of the two inputs. Finds the position of the n'th occurrence of what's wanted with a regexp search in a repeated 15 char string encoding number, fizz, buzz and fizzbuzz in their right places.

added 152 characters in body
Source Link
Kjetil S
  • 6.2k
  • 11
  • 23

Perl 5 -ap, 52 bytes

$_=332312332132330x$F[1];/(.*?$F[0]){$F[1]}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first inputof the two inputs. Finds the position of the n'th occurrence of what's wanted with a regexp search in a repeated 15 char string encoding number, fizz, buzz and fizzbuzz in their right places.

Perl 5 -ap, 52 bytes

$_=332312332132330x$F[1];/(.*?$F[0]){$F[1]}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first input.

Perl 5 -ap, 52 bytes

$_=332312332132330x$F[1];/(.*?$F[0]){$F[1]}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first of the two inputs. Finds the position of the n'th occurrence of what's wanted with a regexp search in a repeated 15 char string encoding number, fizz, buzz and fizzbuzz in their right places.

Source Link
Kjetil S
  • 6.2k
  • 11
  • 23

Perl 5 -ap, 52 bytes

$_=332312332132330x$F[1];/(.*?$F[0]){$F[1]}/g;$_=pos

Try it online!

Where 0=FizzBuzz, 1=Buzz, 2=Fizz, 3=Number in the first input.

AltStyle によって変換されたページ (->オリジナル) /