Did I win the lotto?
Python, 239 chars
import sys
a=map(eval,sys.stdin)
w=lambda x:(0,2,0,3,0,10,7,150,150,1e4,25e4,1e6)[2*len(set(x[1:-1])&set(a[0][1:-1]))+(x[6]==a[0][6])]
s=0
for e in sorted(a[1:],cmp,w,1):
t=w(e);s+=t
if t:print e[0],"- $%u"%t
print"Total Winnings: $%u"%s
Assuming the input numbers are comma separated.
VBA (660 535 Chars)
Assuming delimiter is a space (" "
)...
Sub a(b)
c=Split(b,vbCr)
Set l=New Collection
Set n=New Collection
d=Split(c(0)," ")
For e=1 To UBound(c)
f=Split(c(e)," ")
p=f(0)
i=1
For g=1 To 5:For h=1 To 5
i=i-(d(g)=f(h))
Next:Next
k=IIf(d(6)=f(6),Choose(i,2,3,10,150,10^4,10^6),Choose(i,0,0,0,7,150,500^2))
If k>0 Then
o=1
For m=1 To l.Count
If k>=l(m) Then l.Add k,p,m:n.Add p,p,m:o=0:m=99999
Next
If o Then l.Add k,p:n.Add p,p
End If
Next
For m=1 To l.Count
r=r & n(m) & ":" & Format(l(m),"$#,##0") & vbCr
q=q+l(m)
Next
MsgBox r & "Total Winnings:" & Format(q,"$#,##0")
End Sub
Javascript, 353 Bytes
(function(t){u={"51":1e6,"50":25e4,"41":1e4,"40":150,"31":150,"30":7,"21":10,"11":3,"01":2},a=t.split('\n'),l=a.length-1,m=a[0].split(' '),w=m.slice(1,6),h=0;for(;l--;){s=a[l+1].split(' '),i=s.slice(1,6).filter(function(n){return!!~w.indexOf(n)}),n=i.length+''+(s[6]==m[6]?1:0),v=u[n];if(v){h+=v;console.log(l+'-$'+v)}}console.log('Total Winnings: $'+h)})("0 2 4 23 38 46 23\n" + "1 17 18 22 23 30 40\n" + "2 2 5 24 37 45 23\n" + "3 4 23 38 40 50 9\n" + "4 2 4 23 38 46 17\n" + "5 5 16 32 33 56 46")
ungolfed:
(function (t) {
u = {
"51": 1e6,
"50": 25,
"41": 1e4,
"40": 150,
"31": 150,
"30": 7,
"21": 10,
"11": 3,
"01": 2
},
a = t.split('\n'),
l = a.length - 1,
m = a[0].split(' '),
w = m.slice(1, 6),
h = 0;
for (; l--; ) {
s = a[l + 1].split(' '),
i = s.slice(1, 6).filter(function (n) { return !! ~w.indexOf(n) }),
n = i.length + '' + (s[6] == m[6] ? 1 : 0),
v = u[n];
if (v) {
h += v;
console.log(l + ' - $' + v)
}
}
console.log('Total Winnings: $' + h)
})("0 2 4 23 38 46 23\n" +
"1 17 18 22 23 30 40\n" +
"2 2 5 24 37 45 23\n" +
"3 4 23 38 40 50 9\n" +
"4 2 4 23 38 46 17\n" +
"5 5 16 32 33 56 46")
Could probably knock a few chars off that :D