This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// este es un ejemplo para www.programando.org | |
/* return 1 si el año es bisiesto, 0 si no lo es. | |
Esta función es muy simple y no considera hechos históricos asociados al calendario gregoriano.*/ | |
int is_leap(int year) | |
{ | |
return ((year % 4) == 0) && ( (year % 100) != 0 || (year % 400) == 0 ); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
typedef unsigned long long INT; | |
INT orbita(INT n) { | |
INT largo = 0; | |
do { | |
n = (n % 2) == 0 ? n / 2 : n*3+1; | |
largo++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INT orbita(INT n) { | |
INT largo = 0; | |
do { | |
if (n&0x01) | |
n = ((n<<1)|1)+n; | |
do { | |
n = n>>1; | |
largo++; | |
} while(!(n&0x01)); | |
} while (n>1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hamming(p1,p2,p3): | |
yield 1 | |
m2 = times(p1, hamming(p1,p2,p3)) | |
m3 = times(p2, hamming(p1,p2,p3)) | |
m5 = times(p3, hamming(p1,p2,p3)) | |
for h in merge(merge(m2, m3), m5): | |
yield h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
/* | |
** | |
** Adaptación del código de Jed Davis | |
** En Lambda The Ultimate: http://lambda-the-ultimate.org/node/608#comment-5267 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lar 20 | |
ang 30 | |
axi D | |
D:LALALALALALA | |
L:C++C++C++C++C++C++C | |
C:FFC | |
U:------ | |
A:Uff+F+Fb-b-bb++++ | |
iter 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C --- PROGRAMA 1 ----- | |
read 6, i,k,j | |
99 if(i .lt. j)goto 33 | |
goto 55 | |
33 i=j | |
goto 99 | |
55 k=j+1 | |
stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C --- PROGRAMA 2 ----- | |
read6,i,k,j | |
if(i.lt.j)goto12345 | |
77 k=j+1 | |
goto5555 | |
12345 i=j | |
if(i.lt.j)goto12345 | |
goto77 | |
88 goto88 | |
5555 stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mozilla.universalchardet.UniversalDetector; | |
import java.io.*; | |
import java.nio.charset.Charset; | |
public class DetectEncoding { | |
private static final int BUF_SIZE = 4096; | |
// open a BufferedReader detect encoding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if i >= tam { | |
return nil | |
} else if c < "0" || c > "9" { | |
return nil | |
} else { | |
... | |
} |
OlderNewer