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
; sets the ingame hour (day/night) | |
; @author luxdav aka David_Luchs | |
; @param hour the time between 0 and 23 | |
setTime(hour) | |
{ | |
if(!checkHandles()) | |
return | |
; disable gta setTime function | |
VarSetCapacity(nop, 6, 0) | |
Loop 6 { |
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 static int digitAt(int n, int i) { | |
// (n mod 10^i)/(10^i-1) | |
int a = n % (int) Math.pow(10,i); // a = n modulo 10^i | |
int b = (int) Math.pow(10,i-1); // b 10^-1 | |
return (int) Math.floor(a/b); | |
} |
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
/* | |
* I wanted to understand the inner of an enum better, therefore I tried to build my own enumeration class | |
* that does exactly the same | |
* This code equals to | |
* public enum Enum { | |
* A, B, C; | |
* } | |
*/ | |
import java.lang.reflect.Field; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sierpinski</title> | |
</head> | |
<body> | |
<canvas id="canvas" width="1000" height="1000" style="border:1px solid #FF0000;"></canvas> | |
<script type="text/javascript"> | |
let c = document.getElementById('canvas'); |
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
package euler; | |
public class Prime { | |
public static void main(String[] args) { | |
int n = 100000; | |
// initially assume all integers are prime | |
boolean[] isPrime = new boolean[n+1]; | |
for (int i = 2; i <= n; i++) { |
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
package euler; | |
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
public class Pal { | |
public static void main(String[] args) { | |
System.out.println(isPalindrome(1221)); | |
System.out.println(isPalindrome(1234)); |
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
package euler; | |
public class Divisible { | |
public static void main(String[] args) { | |
for (long i = 0; i < Long.MAX_VALUE; i++) { | |
if (isDivisible(i)) System.out.println(i); | |
} | |
} | |
public static boolean isDivisible(long n) { |
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
package euler; | |
public class Square { | |
public static void main(String[] args) { | |
System.out.println(sum2(100) - sum(100)); | |
} | |
public static int sum(int n) { | |
return n*(n+1)*(2*n+1)/6; |
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
package euler; | |
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
public class AdjacentDigits { | |
private static String n = "731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072962904915604407723907138105158593079608667017242712188399879790879227492190169972088809377665727333001053367881220235421809751254540594752243525849077116705560136048395864467063244157221553975369781797784617406495514929086256932197846862248283972241375657056057490261407972968652414535100474821663704844031998900088952434506585412275886668811642717147992444292823086346567481391912316282458617866458359124566529476545682848912883142607690042242190226710556263211111093705442175069416589604080719840385096245544436298123098787992724428490918884580156166097919133875499200524063 |
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
package euler; | |
public class Triplet { | |
public static void main(String[] args) { | |
int n = 1000; | |
for (int a = 1; a < n; a++) { | |
for (int b = a; b < n; b++) { | |
for (int c = b; c < n; c++) { | |
if (a*a + b*b == c*c && a+b+c == n) { | |
System.out.println(a*b*c); |