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
validar n xs | |
| length num /= n = [] | |
| otherwise = num | |
where num = if not (all isDigit xs) then [] else remover_dups xs |
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 (!it.value.isDigit()) | |
return null | |
if (it.index >= tam) | |
return null | |
else { | |
val digit = it.value.toInt() - '0'.toInt() | |
if (digit in num) return null | |
num = num.plus(digit) | |
} |
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
let validar tam accion = | |
let cars = [for c in accion -> c] | |
if List.exists (fun c -> not (Char.IsDigit c)) cars then List.empty<int> | |
else | |
let org = List.map (fun c -> (int c) - (int '0')) cars | |
let num = List.distinct org | |
if (List.length org <> List.length num) || (List.length num <> tam) then List.empty<int> | |
else num |
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 validar(tam:Int, accion:String) : Option[Array[Int]] = | |
if (accion.exists(c => !c.isDigit) None | |
else { | |
val num = accion.map(c => c.toInt - '0'.toInt).distinct | |
if (num.length == tam && num.length == accion.length) | |
Some(num.toArray) | |
else | |
None | |
} |
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 validar(tam:Int, accion:String) : Option[Array[Int]] = | |
if (accion.exists(!_.isDigit)) | |
None | |
else { | |
val num = accion.map(_.toInt - '0'.toInt).distinct | |
if (num.length == tam && num.length == accion.length) | |
Some(num.toArray) | |
else | |
None | |
} |
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 !c.is_digit(10) { return Error } | |
else if i >= tam { return Error } | |
else { ... } |
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 { | |
... | |
} |
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 !unicode.IsDigit(c) { | |
return nil | |
} else if i >= tam { | |
return nil | |
} else { | |
... | |
} |
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
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 |