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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Temas
Páginas: 1 2 [3] 4 5 6
21  Programación / Java / all in all uva exercise en: 15 Julio 2016, 03:37 am
Citar
You have devised a new encryption technique which encodes a message by inserting between its characters
randomly generated strings in a clever way. Because of pending patent issues we will not discuss in
detail how the strings are generated and inserted into the original message. To validate your method,
however, it is necessary to write a program that checks if the message is really encoded in the final
string.
Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove
characters from t such that the concatenation of the remaining characters is s.
Input
The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII
characters separated by whitespace. Input is terminated by EOF.
Output
For each test case output, if s is a subsequence of t.
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No


y este es mi codigo, no se como solucionarlo, no funciona para todos los casos


Código
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.util.StringTokenizer;
  5.  
  6. /**
  7.  * a->97 z->122 A->65 A->90
  8.  *
  9.  * @author qwery.azc
  10.  */
  11. public class Main {
  12.  
  13.    public String pertenecer(String cadenita, String cadenota) {
  14.        int piv = 0;
  15.        int cajaIndex=0;
  16.        String res="No";
  17.        for (int i = 0; i < cadenita.length(); i++) {
  18.            char caracter=cadenita.charAt(i);
  19.            for (int j = 0; j < cadenota.length() ; j++) {
  20.                if (caracter == cadenota.charAt(j)) {
  21.                    piv++;
  22.                    i++;
  23.  
  24.                }
  25.  
  26.            }
  27.        }
  28.        if(piv==cadenita.length()){
  29.            res="Yes";
  30.        }
  31.        System.out.println(res);
  32.        return res;
  33.    }
  34.  
  35.    public static void main(String argumentos[]) throws IOException {
  36.        Main m = new Main();
  37.         StringTokenizer stk;
  38.         String line;
  39.         String cad1,cad2;
  40.        BufferedReader  scanner = new BufferedReader(new InputStreamReader(System.in));
  41.        while ((line=scanner.readLine())!=null) {
  42.            stk=new StringTokenizer(line," ");
  43.           cad1=stk.nextToken();
  44.           cad2=stk.nextToken();
  45.           m.pertenecer(cad1, cad2);
  46.        }
  47.  
  48.        scanner.close();
  49.    }
  50.    }

aqui va la solucion, pero lo adapto y no da nada

http://solvingproblemsbd.blogspot.com/2014/09/uva-solution-10340-all-in-all.html
22  Programación / Java / operardor >> en java en: 11 Julio 2016, 03:11 am
que clase de operador es este, desde cuando se implemento tal comando.

Código
  1. cuando uso n>>2 es igual n/2


23  Programación / Java / ejerciccio de competencia en: 11 Julio 2016, 02:27 am
Código
  1. Is Bigger Smarter?
  2. Some people think that the bigger an elephant is, the smarter it is. To disprove this, you want to take
  3. the data on a collection of elephants and put as large a subset of this data as possible into a sequence
  4. so that the weights are increasing, but the IQ’s are decreasing.
  5. Input
  6. The input will consist of data for a bunch of elephants, one elephant per line, terminated by the endof-file.
  7. The data for a particular elephant will consist of a pair of integers: the first representing its size
  8. in kilograms and the second representing its IQ in hundredths of IQ points. Both integers are between
  9. 1 and 10000. The data will contain information for at most 1000 elephants. Two elephants may have
  10. the same weight, the same IQ, or even the same weight and IQ.
  11. Output
  12. Say that the numbers on the i-th data line are W[i] and S[i]. Your program should output a sequence
  13. of lines of data; the first line should contain a number n; the remaining n lines should each contain a
  14. single positive integer (each one representing an elephant). If these n integers are a[1], a[2],..., a[n] then
  15. it must be the case that
  16. W[a[1]] < W[a[2]] < ... < W[a[n]]
  17. and
  18. S[a[1]] > S[a[2]] > ... > S[a[n]]
  19. In order for the answer to be correct, n should be as large as possible. All inequalities are strict:
  20. weights must be strictly increasing, and IQs must be strictly decreasing.
  21. There may be many correct outputs for a given input, your program only needs to find one.
  22. Sample Input
  23. 6008 1300
  24. 6000 2100
  25. 500 2000
  26. 1000 4000
  27. 1100 3000
  28. 6000 2000
  29. 8000 1400
  30. 6000 1200
  31. 2000 1900
  32. Sample Output
  33. 4
  34. 4
  35. 5
  36. 9
  37. 7
  38.  
  39.  

alguna solucion ?? no se como comenzar  gracias y saludos



no logro entender como obtiener el Output, en realidad no entiendo el enunciado del todo
24  Foros Generales / Sugerencias y dudas sobre el Foro / algunas incoherencias en el foro (0 visitantes) en: 9 Julio 2016, 17:38 pm


por que sale 0 de visitantes?
25  Programación / Scripting / win32api en: 9 Julio 2016, 15:30 pm
import error: no module named win32api

de donde lo descargo la libreria win32api?
26  Programación / Scripting / variables de entorno python windows 8 en: 9 Julio 2016, 05:39 am
no reconoce el comando python desde el cmd
27  Foros Generales / Dudas Generales / libros interesantes en: 9 Julio 2016, 02:28 am
se animan a hacer una lista de libros interesantes de tecnología con una breve descripción?
28  Programación / Java / identidad por dispositivo de entrada en: 7 Julio 2016, 04:54 am
hola a la comunidad espero puedan ayudarme... quiero implementar biometria de teclado

alguna idea para implementar la biometría de teclado???

ia? redes neuronales? alguna idea?
29  Programación / Java / Ejercicios de Interesantes en: 16 Junio 2016, 22:19 pm
otra forma de encontrar numeros primos y mas eficiente

numeros primos :
30  Programación / Desarrollo Web / Proyectos web en: 16 Junio 2016, 21:43 pm
juego Stix Game html+js+css

https://www.youtube.com/watch?v=uUfmd2SskUY
Páginas: 1 2 [3] 4 5 6
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines