Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
63
Task/Ranking-methods/FreeBASIC/ranking-methods.basic
Normal file
63
Task/Ranking-methods/FreeBASIC/ranking-methods.basic
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
Data 44,"Solomon", 42,"Jason", 42,"Errol", 41,"Garry"
|
||||
Data 41,"Bernard", 41,"Barry", 39,"Stephen"
|
||||
|
||||
Dim Shared As Integer n = 7
|
||||
Dim Shared As Integer puntos(n), i
|
||||
Dim Shared As Single ptosnom(n)
|
||||
Dim Shared As String nombre(n)
|
||||
|
||||
Print "Puntuaciones a clasificar (mejores primero):"
|
||||
For i = 1 To n
|
||||
Read puntos(i), nombre(i)
|
||||
Print Using " ##, \ \"; puntos(i); nombre(i)
|
||||
Next i
|
||||
Print
|
||||
|
||||
Sub MostarTabla
|
||||
For i = 1 To n
|
||||
Print Using " \ \ ##, \ \"; Str(ptosnom(i)); puntos(i); nombre(i)
|
||||
Next i
|
||||
Print
|
||||
End Sub
|
||||
|
||||
Print "--- Standard ranking ---"
|
||||
ptosnom(1) = 1
|
||||
For i = 2 To n
|
||||
If puntos(i) = puntos(i-1) Then ptosnom(i) = ptosnom(i-1) Else ptosnom(i) = i
|
||||
Next i
|
||||
MostarTabla
|
||||
|
||||
|
||||
Print "--- Modified ranking ---"
|
||||
ptosnom(n) = n
|
||||
For i = n-1 To 1 Step -1
|
||||
If puntos(i) = puntos(i+1) Then ptosnom(i) = ptosnom(i+1) Else ptosnom(i) = i
|
||||
Next i
|
||||
MostarTabla
|
||||
|
||||
Print "--- Dense ranking ---"
|
||||
ptosnom(1) = 1
|
||||
For i = 2 To n
|
||||
ptosnom(i) = ptosnom(i-1) - (puntos(i) <> puntos(i-1))
|
||||
Next i
|
||||
MostarTabla
|
||||
|
||||
Print "--- Ordinal ranking ---"
|
||||
For i = 1 To n
|
||||
ptosnom(i) = i
|
||||
Next i
|
||||
MostarTabla
|
||||
|
||||
Print "--- Fractional ranking ---"
|
||||
i = 1
|
||||
Dim As Integer j = 2
|
||||
Do
|
||||
If j <= n Then If (puntos(j-1) = puntos(j)) Then j += 1
|
||||
For k As Integer = i To j-1
|
||||
ptosnom(k) = (i+j-1) / 2
|
||||
Next k
|
||||
i = j
|
||||
j += 1
|
||||
Loop While i <= n
|
||||
MostarTabla
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue