Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Results tagged with code-golf
Search options not deleted
user 36733
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
1
vote
The time after some time
VBA (150149 bytes)
Function t(s)
x = Split(Replace(Replace(Replace(s, "s", ""), "m", " "), "h", " "))
t = Format(TimeSerial(x(0), x(1), x(2)), "HH:MM:SS")
End Function
17
votes
19
answers
1k
views
Variable Prime "Twins"
I am 2/3 twins with my brother, i.e. born on the same day of the same month but twelve years later. When I was 5, he was 17, both primes; the last pair of ages we can reasonably count on is [71, 83] w …
3
votes
How much code would a codegolf golf if a codegolf could golf code?
VBA, 107 bytes
Function q(a,b)
b=b&" "
c="ould "
q="How much "&a&" w"&c&"a "&a&b&b&"if a "&a&b&"c"&c&b&a&"?"
End Function
Should run as VBScript too, I used two shortcuts: "ould " is repeating and …
0
votes
Running length of the movie in a human readable format
VBA, 175 bytes
Sub e(f)
f = Val(f)
h = Int(f / 60)
m = f - h * 60
MsgBox IIf(h > 0, h & " hour" & IIf(h > 1, "s", ""), "") & " " & IIf(m > 0, m & " minute" & IIf(m > 1, "s", ""), "")
End Sub
1
vote
How long ago was this?
VBA, 69 bytes
Function x(s)
g=Split(s, ",")
x=CDate(g(0))-CDate(g(1))
End Function
0
votes
When is Thanksgiving?
VBA, 124 bytes * 75% = 93 bytes
Function e(y)
For i = 1 To 7
x = DateSerial(y, 11, 21) + i
If Weekday(x) = 5 Then e = Format(x, "mmm dd")
Next
End Function
I'm not sure if spaces count, it's somewh …
4
votes
2
answers
303
views
Array combinatoric comparison
Introduction
You may remember sudoku, where there can only be one of each number in each row, column and block of nine.
The general idea is that if the array contains but one element, you can submit …
0
votes
Forecast Palindromic Dates
VBA, 240 193 bytes
Function f(a, b)
Dim j, g()
For i = CDate(a) To CDate(b)
If Format(i, "yyyy") = StrReverse(Format(i, "mmdd")) Then
ReDim Preserve g(j)
g(j) = Format(i, "yyyy-mm …
1
vote
Convert a string of digits from words to an integer
VBA, 160 bytes
Function e(s)
s = Split(s, " ")
For i = LBound(s) To UBound(s)
s(i) = Int((InStr("ontwthfofisiseeini", Left(s(i), 2)) + 1) / 2)
Next
e = Val(Join(s, ""))
End Function
Matches the fir …
2
votes
Substring Sum Set
VBA, 160 bytes
Function e(g())
Dim h()
k=LBound(g)
l=UBound(g)
ReDim h(k To l)
On Error Resume Next
For i=k To l
For j=i To i+g(i)-1
h(i)=h(i)+g(j)
Next
Next
e=h
End Function
0
votes
Goodness Giza Golf!
VBA, 175 bytes
Function e(s) As Boolean
Dim f As Long
For i=1 To Int(Len(s)/2)+1
x=Mid(s,i,1)
If f<>0 And ((f+1)<>x) Or (x<>Mid(s,Len(s)-i+1,1)) Then Exit Function
f=x
Next
e=1
End Function
0
votes
Is this number a prime?
VBA, 160 bytes
For casuals only. Is MsgBox a STDOUT equivalent?
Sub p(n)
Dim t
For i = 2 To n - 1
If n / i = Int(n / i) Then t = True
Next
If t <> True Then
MsgBox n & " is truthy"
Else
MsgBox n & " …
2
votes
Divisibility test
VBA, 46 44 41 bytes
Function f(i,j)
f=i Mod j = 0
End Function