Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
44
Task/Five-weekends/Amazing-Hopper/five-weekends-1.hopper
Normal file
44
Task/Five-weekends/Amazing-Hopper/five-weekends-1.hopper
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include <jambo.h>
|
||||
|
||||
#context Obtiene suma de días de weekend
|
||||
Args ( Domingo, Viernes, Sábado )
|
||||
Not zero( Val( [3:end,Domingo] Of 'calendario' )), Get summatory
|
||||
Not zero( Val( [3:end,Viernes] Of 'calendario' )), Get summatory, Add it
|
||||
Not zero( Val( [3:end,Sábado ] Of 'calendario' )), Get summatory, Add it
|
||||
Return\\
|
||||
|
||||
#define __PRNNL__ {"\n"}print
|
||||
#synon __PRNNL__ *Print it
|
||||
#defn Paralosdías(*) #GENCODE $$$*$$$ #ATCMLIST; #ENDGEN;
|
||||
#enum 1,DOMINGO,6,VIERNES,7,SABADO
|
||||
|
||||
Main
|
||||
Set stack 15
|
||||
|
||||
Init zero (calendario, candidato, total, columna)
|
||||
|
||||
/* Configura meses */
|
||||
Meses={}, mes largo = {}
|
||||
Let list ( Meses := "Enero ","Febrero ","Marzo ","Abril ","Mayo ",\
|
||||
"Junio ","Julio ","Agosto ","Septiembre","Octubre ",\
|
||||
"Noviembre ","Diciembre " )
|
||||
Let list ( mes largo := 1, 3, 5, 7, 8, 10, 12 )
|
||||
|
||||
/* Busca los meses con weekend larguísimo */
|
||||
Loop for (año = 1900, #( año <= 2100), ++año)
|
||||
Loop for( i=1, #(i<=7), ++i)
|
||||
Let ( calendario := Calendar( [i] Of 'mes largo' ---Backup to 'candidato'---,año,1) )
|
||||
|
||||
Para los días 'DOMINGO, VIERNES, SABADO' Obtiene suma de días de weekend
|
||||
|
||||
When ( Is equal to '15' ){
|
||||
++total, Print (año," : ", [candidato] Of 'Meses'," | ")
|
||||
When ( columna++ Is equal to '3' ) { Prnl, columna=0 }
|
||||
}
|
||||
|
||||
Back
|
||||
Back
|
||||
Set ( Utf8("\nTotal de años con weekend de 5 días = "), total ), and Print it
|
||||
End
|
||||
|
||||
Subrutines
|
||||
35
Task/Five-weekends/Amazing-Hopper/five-weekends-2.hopper
Normal file
35
Task/Five-weekends/Amazing-Hopper/five-weekends-2.hopper
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <jambo.h>
|
||||
|
||||
#define __PRNNL__ {"\n"}print
|
||||
#synon __PRNNL__ *Print it
|
||||
#synon Set *Set
|
||||
|
||||
Main
|
||||
Set stack 15
|
||||
|
||||
Init zero (candidato, total, sin weekend largo, sw, columna, fecha)
|
||||
|
||||
/* Configura meses */
|
||||
mes largo = {}
|
||||
Let list ( mes largo := 1, 3, 5, 7, 8, 10, 12 )
|
||||
|
||||
/* Busca los meses con weekend larguísimo */
|
||||
Loop for (año = 1900, #( año <= 2100), ++año)
|
||||
Loop for( i=1, #(i<=7), ++i)
|
||||
|
||||
Let ( candidato := [i] Of 'mes largo' )
|
||||
Let ( fecha := Multicat ("1/",Str(candidato),"/",Str(año)) )
|
||||
|
||||
When ( Strday 'fecha' Is equal to '"Viernes"', \
|
||||
And ( Days of month 'fecha' Compared to '31', Are equals? )) {
|
||||
++total, sw=1
|
||||
Print (año," : ", Just left (13, Month name 'candidato')," | ")
|
||||
When ( columna++ Is equal to '3' ) { Prnl, columna=0 }
|
||||
}
|
||||
|
||||
Back
|
||||
When ( Not( sw ) ) { ++ sin weekend largo }, sw=0
|
||||
Back
|
||||
now Set ( Utf8("\nTotal de años con weekend de 5 días = "), total )
|
||||
and Set ( Utf8("\nAños sin weekend de 5 días: "), sin weekend largo) then Print it
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue