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.util.*; | |
import java.math.*; | |
public class MultiWordIntersection{ | |
public static int MultiIntersection(ArrayList<String> a, String sword){ | |
int sum = 0; | |
SurfaceWord sw = new SurfaceWord(sword); | |
for(int i=0;i<a.size();i++){ | |
WordVector p = new WordVector(sw.toNumber(a.get(i))); | |
for(int j=i+1;j<a.size();j++){ | |
WordVector p1 = new WordVector(sw.toNumber(a.get(j))); |
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.util.*; | |
public class bio{ | |
public static void main(String[] args){ | |
char[] c = "aabc".toCharArray(); | |
//String s = "eabahgcabah"; | |
String s = "aaaaaaabc"; | |
int[] r = list(c,s); | |
for(int i=0;i<r.length;i++){ | |
System.out.println(r[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
import java.util.*; | |
public class expectedcars { | |
public static void main(String[] args){ | |
int n = 100000; | |
int l = 10000; | |
long z = 0; | |
for(int i=0;i<l;i++){ | |
z+=n-simulate(n); | |
} | |
System.out.println(((double) z)/((double) l)); |
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
#include <stdlib.h> | |
#include <time.h> | |
#include "iostream" | |
#include <math.h> | |
using namespace std; | |
double p; | |
int interval(double l, double a){ | |
a = a - floor(a); | |
if(l<1.0) return 0; |
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 SquareRoot { | |
public static double sqrt(int n){ | |
int[] v = vector(n); | |
return magnitude(v); | |
} | |
public static double magnitude(int[] v){ | |
double a=v[1],b=v[0]; | |
if(v.length>2){ | |
int[] u = new int[v.length-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
#include <stdlib.h> | |
#include <time.h> | |
#include "iostream" | |
#include <math.h> | |
using namespace std; | |
double p; | |
//n is the length of a car | |
double n; | |
double e = 0.0000001; | |
//double e = 0; |
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
#!/bin/bash | |
rm screenshot.png -f | |
if [ $# -ne 0 ] | |
then | |
if [ "X$1" = "Xs" ] | |
then | |
scrot screenshot.png -s | |
else | |
scrot screenshot.png -d $1 | |
fi |
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
#!/usr/bin/python | |
import sys | |
import atexit | |
import time | |
global count | |
global fname | |
fname = '/home/mgccl/.keycount' | |
def savecounter(): | |
f = open(fname,'w') |
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 string | |
import sys | |
input = sys.stdin | |
ls = input.readlines() | |
a = "!!!!!!! " | |
b = "!!!!!!! " | |
c = "尼玛" | |
d = "???!!!! " | |
e = "???!!!! " |
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
#!/bin/sh | |
d="$HOME/wallpaper" | |
o=`mktemp` | |
c=`ls $d | grep -iE "(.jpg|.gif|.png)" | sort -R | head -2` | |
if [ $# -gt 0 ] ; then | |
a=$1 | |
else | |
a=`echo $c | cut -d " " -f 1` |