19.05.2013 Views

PROBLEMAS RESUELTOS - ICPC Bolivia

PROBLEMAS RESUELTOS - ICPC Bolivia

PROBLEMAS RESUELTOS - ICPC Bolivia

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PROBLEMAS</strong> <strong>RESUELTOS</strong><br />

bontres<br />

zoggax<br />

wiinq<br />

eep<br />

houctuh<br />

end<br />

Ejemplo de salida<br />

is acceptable.<br />

is not acceptable.<br />

is not acceptable.<br />

is not acceptable.<br />

is not acceptable.<br />

is not acceptable.<br />

is acceptable.<br />

is acceptable.<br />

Solución<br />

Este problema presenta tres simples reglas que se<br />

deben cumplir para que un password sea aceptable.<br />

Primero es necesario identificar si un carácter es vocal<br />

o no, para lo cual utilizo la siguiente función que pregunta si<br />

el carácter es una vocal, y devuelve 1 (true) por verdad y 0<br />

(false) por falso.<br />

int isVowel( char ch ){<br />

if( ch=='a' || ch=='e' || ch=='i'<br />

|| ch=='o' || ch=='u' )<br />

return 1;<br />

return 0;<br />

}<br />

También podemos utilizar la un MACRO para reemplazar<br />

esta función en C:<br />

#define isVowel( ch )<br />

(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')<br />

El código es representado como función para simplificar<br />

la comprensión de su traducción en JAVA.<br />

28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!