Skip to content

Instantly share code, notes, and snippets.

View cobymotion's full-sized avatar
💭
Can I help you?

Luis Cobian cobymotion

💭
Can I help you?
View GitHub Profile
@cobymotion
cobymotion / Principal.java
Created February 29, 2024 13:48
HilosEjemplo
public class Principal {
public static void main(String[] args) {
Plantilla p = new Plantilla();
p.setTarea("A");
// p.tarea = "A"; no permitido
p.setHiloPrimero(null);
Thread otro = new Thread(new Plantilla2());
Thread h1 = new Thread(p);
Plantilla pp = new Plantilla("Tarea 2",h1);
Thread h2 = new Thread(pp);
@cobymotion
cobymotion / Main.java
Last active February 28, 2024 14:13
OmegaUP Ej774
import java.util.*;
/**
Author: Luis Cobián
*/
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
float suma =0;
for(int i=0;i<n;i++){
@cobymotion
cobymotion / Algoritmos.psc
Created October 5, 2021 16:55
Ejercicios de PSEINT
EJERCICIO 1
// algoritmo que me permite cambiar una hora dada en formato
// de 24 a 12
// Luis Cobian
// 5 de Octubre
Algoritmo NumeroFormato24
Escribir "Dame una hora:"
leer h
public class Taxi { //El nombre de la clase
private String ciudad; //Ciudad de cada objeto taxi
private String matricula; //Matrícula de cada objeto taxi
private String distrito; //Distrito asignado a cada objeto taxi
private int tipoMotor; //tipo de motor asignado a cada objeto taxi. 0 = desconocido, 1 = gasolina, 2 = diesel
@cobymotion
cobymotion / wsejemplo.html
Created April 18, 2021 17:25
Leer datos de un socket TCP en un websocket
<!doctype html>
<style>
textarea { vertical-align: bottom; }
#output { overflow: auto; }
#output > p { overflow-wrap: break-word; }
#output span { color: blue; }
#output span.error { color: red; }
</style>
<h2>WebSocket Test</h2>
<textarea cols=60 rows=6></textarea>
@cobymotion
cobymotion / LeerSocket.cs
Created April 18, 2021 17:21
Metodo a partir de un TCP socket leer websocket
+using Microsoft.SqlServer.Server;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
import java.util.Arrays;
import java.util.Scanner;
public class EjemploMatriz {
public static void main(String[] args) {
/// arreglo de dos dimensiones
String[] nombres[] = new String[3][3];
/// solo imprime una dimension
@cobymotion
cobymotion / Main.java
Created October 7, 2019 03:26
Derdenio y sus Estructuras de Datos
public class Main{
public static void main(String[] args) {
java.util.Scanner sc = new java.util.Scanner(System.in);
int n = sc.nextInt();
int []arr = new int[n*2];
for(int i=0;i<n*2;i++)
arr[i]=sc.nextInt();
java.util.Arrays.sort(arr);
for(int i=n*2-1;i>=0;i--)
System.out.println(arr[i]);
@cobymotion
cobymotion / dishes.py
Created September 14, 2019 16:04
Programa dishes omega
exp = 0
# lista con todos los pesos que se quieren medir
lista = list()
while(exp<=14):
lista.append(2**exp)
exp+=1
lista.reverse()
while True:
try:
# se le el tamaño del plato
@cobymotion
cobymotion / Main.java
Created September 5, 2019 04:26
Factorial simple
// clase para poder manejar numeros muy grandes
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//leemos el numero el cual calcularemos el factorial