elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5
21  Programación / Ejercicios / Re: Mini Reto Python. Dibujar rombo ~ en: 1 Diciembre 2010, 23:43 pm
Si, son nueve niveles, pero recuerda el numero de lineas se pasa por parametro, asi que no importa, mientras graficamente ser parezca a la imagen. Unicamente con el uso de asteriscos.

Saludos.
22  Programación / Ejercicios / Mini Reto Python. Dibujar rombo ~ en: 1 Diciembre 2010, 23:34 pm
Se debe realizar una funcion en python el cual dibuje un rombo de asteriscos "*". Se le debe pasar por parametro el numero de lineas.

Debiera quedar mas o menos asi:


Espero se animen. xDnk!
23  Programación / Scripting / Re: [Python] - ¿Es primo? en: 1 Diciembre 2010, 23:26 pm
Citar
Dnk!, en realidad el 2 también es primo

Ups, pensaba que no. Ajam es verdad, esa parte me la he saltado, todo por las prisas xD.
24  Programación / Programación Visual Basic / Re: Valium 1.0 [Manda a tu pc a dormir] en: 1 Diciembre 2010, 22:38 pm
Para la proxima version podrias ponerle "apagar en 3 horas 20 min" asi pensamos menos :xD :xD

En un rato pispeo el code

Y es facil de implementar, solo tienes k sumarle los minutos al current time, es decir, dos lineas y listo, y asi los que tenemos prisa en coger la cama no tenemos que hacer calculos en la hora exacta que es depues de 3 horas y 20 minutos por ej...  :xD
25  Programación / Scripting / Re: [Python] - ¿Es primo? en: 1 Diciembre 2010, 22:32 pm
Pienso que asi queda mejor, haganme saber recien empiezo en python  :-*

Código
  1. #!/usr/bin/python
  2.  
  3. def esPrimo(num):
  4.    if num < 2: return False
  5.    for i in range(2,num):
  6.        if (num%i==0):
  7.            return False
  8.    return True
  9.  

xDnk!
26  Programación / Ejercicios / Re: Reto/Juego Ejercicios en Python en: 1 Diciembre 2010, 20:11 pm
No muerto no, aqui uno se une a los retos, pero ya me espero al siguiente que tengo tarea que hacer  :rolleyes:
27  Foros Generales / Foro Libre / Re: [Juego] El super h4x0r de la muerte en: 1 Diciembre 2010, 15:53 pm
Creo que hay unas personas que nunca han posteado... podría ser buena ténica. Los agregaré a mi lista imaginaria :xD
Por otro lado la pista del hacker es interesante... :¬¬
Y Og. cambió la estrategia desde que lo acusaron... sospechoso :¬¬
Mi voto es para Og.

Te puedo asegurar que soy real y unico. Y no me parezco a ninguno de vosotros/as, (yo soy mas guapo/a), ni fisica ni molecularmente.

Para la prox me gustaria participar, hay lo dejo  :laugh:
28  Programación / Programación General / Re: [Ehn-Dev 2010] - Votaciones!!! en: 1 Diciembre 2010, 14:43 pm
Se ve que hay mucho gammer por aki  :silbar:

Aun asi estan todos muy elaborados y algunos bastantes novedosos  ;-)
29  Foros Generales / Foro Libre / Re: [Juego] El super h4x0r de la muerte en: 1 Diciembre 2010, 13:53 pm
Aunque no pinto nada... quiero pensar que Og. O algun conocido de kuroi shonen spider, suplanto su indentidad para asi despistar. Creo que esa es la pista  :silbar:
30  Programación / Java / [SRC] Calculadora Matricial ~ en: 1 Diciembre 2010, 11:52 am
Aqui os presento mi modesta y humilde obra. Pero cuan cariño le tengo XD. No mucho mas que decir, ya viene todo explicado en el source. Le he añadido las importaciones de java.util, ademas de un main, para que os sea mas facil probar la clase, si lo quieren como clase externa solo borren esto y ya esta.

Código
  1. /* AUTOR: d3n3k4 (Dnk!)
  2.  * WEB: http://d3n3k4.blogspot.com/
  3.  * FECHA: 01/DIC/2010
  4.  * DESCRIPCION:
  5.  * - Contiene varias clases que realizan calculos matriciales como:
  6.  * - suma y resta de matrices.
  7.  * - producto de matrices.
  8.  * - calcular la matriz transpuesta de una matriz.
  9.  * - comprobar si dos matrices son iguales.
  10.  * - comprobar si una matriz es cuadrada o no.
  11.  * - comprobar si una matriz es simetrica.
  12.  * - Se iran añadiendo mas funcionalidades, como multiplicacion por una constante,
  13.  *  calcular determinante, rango, etc... y seran expuestas en mi web.
  14.  * NOTA: Este codigo es libre y puede ser usado,modificado... siempre y cuando se
  15.  * mantenga los creditos y comentarios del autor.
  16.  */
  17. import java.util.Scanner;
  18.  
  19. public class CalC {
  20. public static int[][] leeMatriz(int nFila, int nCol){
  21. int[][] matriz = new int[nFila][nCol];
  22. Scanner entrada = new Scanner(System.in);
  23.  
  24. for (int i = 0; i < nFila; i++) {
  25. for (int j = 0; j < nCol; j++) {
  26. matriz[i][j] = entrada.nextInt();
  27. }
  28. }
  29. return matriz;
  30. }
  31. public static String escribeMatriz(int[][] matriz) {
  32. String mat = "";
  33. if (matriz != null) {
  34. for (int i = 0; i < matriz.length; i++) {
  35. mat += "|   ";
  36. for (int j = 0; j < matriz[0].length; j++) {
  37. mat += matriz[i][j] + "  ";
  38. }
  39. mat += "   |\n";
  40. }
  41. }
  42. return mat;
  43. }
  44. public static int[][] sumaMatrices(int[][] mat1,int[][] mat2,boolean resta) {
  45. int[][] matSal = null;
  46.  
  47. if (mat1.length == mat2.length && mat1[0].length == mat2[0].length) {
  48. if (resta == true) { //cambia de signo mat2 para despues sea restada.
  49. for (int i = 0; i < mat2.length; i++) {
  50. for (int j = 0; j < mat2[0].length;j++) {
  51. mat2[i][j] = mat2[i][j] * -1;
  52. }
  53. }
  54. }
  55. matSal = new int[mat1.length][mat1[0].length];
  56. for (int i = 0; i < mat1.length; i++) {
  57. for (int j = 0; j < mat1[0].length; j++) {
  58. matSal[i][j] = mat1[i][j] + mat2[i][j];
  59. }
  60. }
  61. }
  62. return matSal;
  63. }
  64. public static int[][] transpuesta(int[][] mat1) {
  65. int[][] M_trans = new int[mat1[0].length][mat1.length];
  66.  
  67. for (int i = 0; i < M_trans.length; i++) {
  68. for (int j = 0; j < M_trans[0].length;j++) {
  69. M_trans[i][j] = mat1[j][i];
  70. }
  71. }
  72. return M_trans;
  73. }
  74. public static int[][] productoMatriz(int[][] mat1,int[][] mat2) {
  75. int[][] matSal = null;
  76.  
  77. if (mat1[0].length == mat2.length) {
  78. matSal = new int[mat1.length][mat2[0].length];
  79.  
  80. for (int i = 0; i < matSal.length; i++) {
  81. for (int j = 0; j < matSal[0].length; j++) {
  82. for (int k = 0; k < mat2.length; k++) {
  83. matSal[i][j] += mat1[i][k] * mat2[k][j];
  84. }
  85. }
  86. }
  87. }
  88. return matSal;
  89. }
  90. public static boolean esIgual(int[][] mat1,int[][] mat2) {
  91. boolean igual = false;
  92.  
  93. if (mat1.length == mat2.length && mat1[0].length == mat2[0].length) {
  94. igual = true;
  95. for (int i = 0; i < mat1.length; i++) {
  96. for (int j = 0; j < mat1.length; j++) {
  97. if (mat1[i][j] != mat2[i][j]) {
  98. igual = false;
  99. }
  100. }
  101. }
  102. }
  103. return igual;
  104. }
  105. public static boolean esCuadrada(int[][] mat1) {
  106. boolean cuadrada = false;
  107. if (mat1.length == mat1[0].length) {
  108. cuadrada = true;
  109. }
  110. return cuadrada;
  111. }
  112. public static boolean esSimetrica(int[][] mat1) {
  113. boolean simetrica = false;
  114. int[][] mat2 = transpuesta(mat1);
  115. if (esIgual(mat1,mat2)) {
  116. simetrica = true;
  117. }
  118. return simetrica;
  119. }
  120. public static void main(String[] args) {
  121. /*int[][] matriz1,matriz2,resultado = null;
  122. Scanner entrada = new Scanner(System.in);
  123. int filas = 0, columnas = 0;*/
  124.  
  125. /*System.out.println("Introduce el numero de filas");
  126. filas = entrada.nextInt();
  127. System.out.println("Introduce el numero de columnas");
  128. columnas = entrada.nextInt();
  129. System.out.println("Introduce la primera matriz:");
  130. matriz1 = leeMatriz(filas,columnas);*/
  131.  
  132. /*System.out.println("Introduce el numero de filas");
  133. filas = entrada.nextInt();
  134. System.out.println("Introduce el numero de columnas");
  135. columnas = entrada.nextInt();
  136. System.out.println("Introduce la primera matriz:");
  137. matriz2 = leeMatriz(filas,columnas);*/
  138.  
  139. //resultado = sumaMatrices(matriz1,matriz2,true);
  140. //resultado = transpuesta(matriz1);
  141. //resultado = productoMatriz(matriz1,matriz2);
  142. /*if (resultado == null) {
  143. System.out.println("Error");
  144. }*/
  145. /*if (esIgual(matriz1,matriz2)) {
  146. System.out.println("Son iguales");
  147. } else {
  148. System.out.println("No son iguales");
  149. }*/
  150. /*if (esCuadrada(matriz1)) {
  151. System.out.println("Es cuadrada");
  152. } else {
  153. System.out.println("No es cuadrada");
  154. }*/
  155. /*if (esSimetrica(matriz1)) {
  156. System.out.println("Es simetrica");
  157. } else {
  158. System.out.println("No es simetrica");
  159. }*/
  160. //System.out.print(escribeMatriz(resultado));
  161. }
  162.  
  163. }
  164.  

xDnk!
Recuerden respeten el autor  ;)
Páginas: 1 2 [3] 4 5
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines