- 12.9k
- 2
- 71
- 55
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
( # 3円 = the following (after the first iteration has finished),
# which is always 1
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!3円) # Match this alternative only if this is the first iteration of
# the loop, meaning 4円 is unset; 3円 can never not match here if
# 3円 is set (because 3円==1) unless 1円==0, in which case it
# doesn't matter if the abovethis alternative is taken instead, of the
# becauseabove – in that case, the value of 4円 isn't changed anyway.
1円 # 4円 = divisor-1
)
)
)* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 5円 = remainder
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
( # 3円 = the following (after the first iteration has finished),
# which is always 1
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!3円) # Match this alternative only if this is the first iteration of
# the loop, meaning 4円 is unset; 3円 can never not match here if
# 3円 is set (because 3円==1) unless 1円==0, in which case it
# doesn't matter if the above alternative is taken instead,
# because in that case, the value of 4円 isn't changed anyway.
1円 # 4円 = divisor-1
)
)
)* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 5円 = remainder
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
( # 3円 = the following (after the first iteration has finished),
# which is always 1
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!3円) # Match this alternative only if this is the first iteration of
# the loop, meaning 4円 is unset; 3円 can never not match here if
# 3円 is set (because 3円==1) unless 1円==0, in which case it
# doesn't matter if this alternative is taken instead of the
# above – in that case, the value of 4円 isn't changed anyway.
1円 # 4円 = divisor-1
)
)
)* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 5円 = remainder
Regex (Java), (削除) 41 (削除ここまで) 40(削除) 40 (削除ここまで) 38 bytes
x(x*),((x(?=(4円1円|(?!5円3円)1円)()))*)4円?(x*)
This is a port of the Perl/PCRE regex to a flavor that has no conditionals. Emulating a conditional costs 5(削除) 5 (削除ここまで) 3 bytes here. The quotient and remainder are returned in the capture groups 2円 and 6円5円, respectively.
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
( # 3円 = the following (after the first iteration has finished),
x # which is always 1
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!5円3円) # matchMatch this alternative only if 4円this is unsetthe first iteration of
1円 # the loop, meaning 4円 =is divisor-1unset; 3円 can never not match here if
)
# 3円 is set (because 3円==1) unless 1円==0, in which case it
# 5円doesn't =matter setif tothe indicateabove alternative is taken instead,
# because in that case, the value of 4円 isisn't setchanged anyway.
1円 # 4円 = divisor-1
)
)* )* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 6円5円 = remainder
Regex (Java), (削除) 41 (削除ここまで) 40 bytes
x(x*),((x(?=(4円1円|(?!5円)1円)()))*)4円?(x*)
This is a port of the Perl/PCRE regex to a flavor that has no conditionals. Emulating a conditional costs 5 bytes here. The quotient and remainder are returned in the capture groups 2円 and 6円, respectively.
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
(
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!5円) # match this alternative only if 4円 is unset
1円 # 4円 = divisor-1
)
() # 5円 = set to indicate that 4円 is set
)
)* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 6円 = remainder
Regex (Java), (削除) 41 (削除ここまで) (削除) 40 (削除ここまで) 38 bytes
x(x*),((x(?=(4円1円|(?!3円)1円)))*)4円?(x*)
This is a port of the Perl/PCRE regex to a flavor that has no conditionals. Emulating a conditional costs (削除) 5 (削除ここまで) 3 bytes here. The quotient and remainder are returned in the capture groups 2円 and 5円, respectively.
x(x*), # 1円 = divisor-1; tail = dividend
( # 2円 = what will be the quotient
( # 3円 = the following (after the first iteration has finished),
# which is always 1
x # tail -= 1
(?=
( # 4円 = running total
4円 # recall the previous contents of 4円 (only if it is set)
1円 # 4円 += divisor-1
|
(?!3円) # Match this alternative only if this is the first iteration of
# the loop, meaning 4円 is unset; 3円 can never not match here if
# 3円 is set (because 3円==1) unless 1円==0, in which case it
# doesn't matter if the above alternative is taken instead,
# because in that case, the value of 4円 isn't changed anyway.
1円 # 4円 = divisor-1
)
) )* # Loop the above as many times as possible (zero or more); if
# it loops zero times, 4円 will be unset (we'll treat that as 0)
)
4円? # tail -= 4,円 or leave tail unchanged if 4円 is unset
(x*) # 5円 = remainder
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55
- 12.9k
- 2
- 71
- 55