Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
58
Task/Eban-numbers/FreeBASIC/eban-numbers.basic
Normal file
58
Task/Eban-numbers/FreeBASIC/eban-numbers.basic
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
' Eban_numbers
|
||||
' Un número eban es un número que no tiene la letra e cuando el número está escrito en inglés.
|
||||
' O más literalmente, los números escritos que contienen la letra e están prohibidos.
|
||||
'
|
||||
' Usaremos la versión americana de los números de ortografía (a diferencia de los británicos).
|
||||
' 2000000000 son dos billones, no dos millardos (mil millones).
|
||||
'
|
||||
|
||||
Data 2, 1000, 1
|
||||
Data 1000, 4000, 1
|
||||
Data 2, 10000, 0
|
||||
Data 2, 100000, 0
|
||||
Data 2, 1000000, 0
|
||||
Data 2, 10000000, 0
|
||||
Data 2, 100000000, 0
|
||||
Data 0, 0, 0
|
||||
|
||||
Dim As Double tiempo = Timer
|
||||
Dim As Integer start, ended, printable, count
|
||||
Dim As Long i, b, r, m, t
|
||||
Do
|
||||
Read start, ended, printable
|
||||
|
||||
If start = 0 Then Exit Do
|
||||
If start = 2 Then
|
||||
Print "eban numbers up to and including"; ended; ":"
|
||||
Else
|
||||
Print "eban numbers between "; start; " and "; ended; " (inclusive):"
|
||||
End If
|
||||
|
||||
count = 0
|
||||
For i = start To ended Step 2
|
||||
b = Int(i / 1000000000)
|
||||
r = (i Mod 1000000000)
|
||||
m = Int(r / 1000000)
|
||||
r = (i Mod 1000000)
|
||||
t = Int(r / 1000)
|
||||
r = (r Mod 1000)
|
||||
If m >= 30 And m <= 66 Then m = (m Mod 10)
|
||||
If t >= 30 And t <= 66 Then t = (t Mod 10)
|
||||
If r >= 30 And r <= 66 Then r = (r Mod 10)
|
||||
If b = 0 Or b = 2 Or b = 4 Or b = 6 Then
|
||||
If m = 0 Or m = 2 Or m = 4 Or m = 6 Then
|
||||
If t = 0 Or t = 2 Or t = 4 Or t = 6 Then
|
||||
If r = 0 Or r = 2 Or r = 4 Or r = 6 Then
|
||||
If printable Then Print i;
|
||||
count += 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
If printable Then Print
|
||||
Print "count = "; count & Chr(10)
|
||||
Loop
|
||||
tiempo = Timer - tiempo
|
||||
Print "Run time: " & (tiempo) & " seconds."
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue