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 java.math.BigInteger; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Map; | |
import java.util.Scanner; | |
import java.util.Set; | |
/** | |
* Crazy Croupier - 2nd Tuenti Challenge - 12 | |
* |
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 java.io.PrintStream; | |
public class MagicalLand { | |
public static void main(String[] args) { | |
for (int i = 0; i < (Math.random() * 500) + 2; i++) { | |
if (Unicorn.pat()) { | |
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE"); | |
} | |
} | |
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 unittest | |
def IsOdd(n): | |
return n % 2 == 1 | |
class IsOddTests(unittest.TestCase): | |
def testOne(self): | |
self.failUnless(IsOdd(1)) | |
def testTwo(self): |
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
for n in range(2, 1000): | |
for x in range(2, n): | |
if n % x == 0: | |
print n, 'equals', x, '*', n/x | |
break | |
else: | |
print n, ' true' |
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
public String apply(String input) { | |
char[] chars = input.toCharArray(); | |
int index; | |
for (index = 0; index < input.length(); index++) { | |
if (chars[index] != '0') { | |
break; | |
} | |
} | |
return (index == 0) ? input : input.substring(index); |
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
Map<String, String> map = new HashMap<String, String>(); | |
map.put("1","abc"); | |
map.put("2", "def"); | |
for (Map.Entry<String, String> entry : map.entrySet()) { | |
System.out.println(entry.getValue() + ":" + entry.getKey()); | |
} |
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
CLIENTES | |
======== | |
id: INT | |
nombre: VARCHAR(255) | |
dni: VARCHAR(12) | |
PEDIDOS | |
======= | |
id: INT | |
id_producto: INT |
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
public class Stack { | |
private Object [ ] items ; | |
private int top ; | |
public Stack ( int size ) { | |
this items = new Object [ size ] ; | |
this top = - 1 ; | |
} |
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
public class Coordinates { | |
private double longitude; | |
private double latitude; | |
public Coordinates(double longitude, double latitude) { | |
this.longitude = longitude; | |
this.latitude = latitude; | |
} | |
} |
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
interface Animal { | |
void eat() | |
} | |
class Mammal implements Animal { | |
void eat() { | |
System.out.println("mammal eating"); | |
} | |
} |
OlderNewer