Skip to content

Instantly share code, notes, and snippets.

@nomeaning777
Created September 13, 2012 06:17
Show Gist options
  • Save nomeaning777/3712287 to your computer and use it in GitHub Desktop.
Save nomeaning777/3712287 to your computer and use it in GitHub Desktop.
Module MainModule
Sub Main()
Dim comb(101, 101) As Integer, ans As Integer = 0
comb(0, 0) = 1
For i = 0 To 100
For j = 0 To i
comb(i + 1, j) += comb(i, j)
If comb(i + 1, j) > 1000000 Then
comb(i + 1, j) = 1000000
End If
comb(i + 1, j + 1) += comb(i, j)
If comb(i + 1, j + 1) > 1000000 Then
comb(i + 1, j + 1) = 1000000
End If
If comb(i, j) >= 1000000 Then
ans += 1
End If
Next
Next
Console.WriteLine(ans) ' 4075
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment